RHCSA Rapid Track
Use file system permissions to create a directory in which all members of a particular group can add and delete files.
Outcomes
Create a collaborative directory that all members of a group can access.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start perms-cli
Instructions
From
workstation, log in toserveraas thestudentuser and switch to therootuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#Create the
/home/consultantsdirectory.[root@servera ~]#
mkdir /home/consultantsChange the group ownership of the
consultantsdirectory toconsultants.[root@servera ~]#
chown :consultants /home/consultantsModify the permissions of the
consultantsgroup to allow its group members to create files in, and delete files from, the/home/consultantsdirectory.The current permissions forbid others from accessing the files. You must set the appropriate permissions.
Verify that the permissions of the
consultantsgroup allow its group members to create files in, and delete files from, the/home/consultantsdirectory.Note that the
consultantsgroup currently does not have write permission.[root@servera ~]#
ls -ld /home/consultantsdrwxr-xr-x. 2 root consultants 6 Mar 1 12:08 /home/consultantsAdd write permission to the
consultantsgroup. Use the symbolic method for setting the appropriate permissions.[root@servera ~]#
chmod g+w /home/consultants[root@servera ~]#ls -ld /home/consultantsdrwxrwxr-x. 2 root consultants 6 Mar 1 13:21 /home/consultantsForbid others from accessing files in the
/home/consultantsdirectory. Use the octal method for setting the appropriate permissions.[root@servera ~]#
chmod 770 /home/consultants[root@servera ~]#ls -ld /home/consultantsdrwxrwx---. 2 root consultants 6 Mar 1 12:08 /home/consultants/
Exit the
rootshell and switch to theconsultant1user. The password isredhat.[root@servera ~]#
exitlogout [student@servera ~]$su - consultant1Password:redhat[consultant1@servera ~]$Navigate to the
/home/consultantsdirectory and create a file calledconsultant1.txt.Change to the
/home/consultantsdirectory.[consultant1@servera ~]$
cd /home/consultantsCreate an empty file called
consultant1.txt.[consultant1@servera consultants]$
touch consultant1.txt
List the contents of the
/home/consultantsdirectory.[consultant1@servera consultants]$
lsconsultant1.txtExit the shell and switch to the
consultant2user. The password isredhat.[consultant1@servera consultants]$
exitlogout [student@servera ~]$su - consultant2Password:redhat[consultant2@servera ~]$Navigate to the
/home/consultantsdirectory. Ensure that theconsultant2user can add content to theconsultant1.txtfile.Change to the
/home/consultantsdirectory. Create an empty file calledconsultant2.txt.[consultant2@servera ~]$
cd /home/consultants/[consultant2@servera consultants]$touch consultant2.txt
List the contents of the
/home/consultantsdirectory.[consultant2@servera consultants]$
lsconsultant1.txt consultant2.txtReturn to the
workstationsystem as thestudentuser.[consultant2@servera consultants]$
exitlogout [student@servera ~]$exitlogout Connection to servera closed. [student@workstation ~]$