Modify file and directory ownership.
Outcomes
Identify membership information for user accounts.
Update the ownership of files and directories.
As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.
[student@workstation ~]$ lab start users-accounts
Instructions
Log out of the student user session and log in as the sales01 user.
Use redhat as the password.
From the system menu, select . Confirm the operation by clicking .
On the login screen, select the sales01 user and use redhat as the password.
Open a terminal.
View the group membership of the sales01, sales05, and sales12 users.
Identify the group that the sales01, sales05, and sales12 users have in common.
View the group membership of the sales01 user.
[sales01@workstation ~]$ groups sales01
sales01 : sales01 emea hybrid sales-teamView the group membership of the sales05 user.
[sales01@workstation ~]$ groups sales05
sales05 : sales05 latam remote sales-teamView the group membership of the sales12 user.
[sales01@workstation ~]$ groups sales12
sales12 : sales12 na remote sales-teamAccording to the group information, the three users have the sales-team group in common.
View the owner information of the /Finance/Sales-Reports directory.
Try to set the sales-team group as the owner of the /Finance/Sales-Reports directory and its contents.
View the long listing information of the /Finance/Sales-Reports directory.
[sales01@workstation ~]$ ls -ld /Finance/Sales-Reports
drwxr-xr-x. 2 root root 34 Oct 31 23:46 /Finance/Sales-ReportsTry to set the sales-team group as the owner of the /Finance/Sales-Reports directory and its contents.
[sales01@workstation ~]$ chown -R :sales-team /Finance/Sales-Reports/
chown: changing group of '/Finance/Sales-Reports/January': Operation not permitted
chown: changing group of '/Finance/Sales-Reports/April': Operation not permitted
chown: changing group of '/Finance/Sales-Reports/': Operation not permittedThe command fails because the sales01 user is not the owner of the Sales-Reports directory.
This user does not have permissions to modify the owner of the directory.
Verify the sudo privileges of the sales01 user.
Use your sudo privilege for the chown command to set the sales-team group as the owner of the /Finance/Sales-Reports directory.
Verify the sudo privileges of the sales01 user.
[sales01@workstation ~]$sudo -l[sudo] password for sales01:redhat...output omitted... User sales01 may run the following commands on workstation: (root) /bin/chown * /Finance/*
Use your sudo privilege for the chown command to set the sales-team group as the owner of the /Finance/Sales-Reports directory.
[sales01@workstation ~]$ sudo chown -R :sales-team /Finance/Sales-Reports/Verify that the sales-team group is the owner of the /Finance/Sales-Reports directory.
[sales01@workstation ~]$ ls -ld /Finance/Sales-Reports
drwxr-xr-x. 2 root sales-team 34 Oct 31 23:46 /Finance/Sales-ReportsLog out of the sales01 user session and log in as the student user.
Use student as the password.
From the system menu, select . Confirm the operation by clicking .
On the login screen, select the student user and use student as the password.
Open a terminal.