RHCSA Rapid Track
In this exercise, you will use file system permissions to create a directory in which all members of a particular group can add and delete files.
Outcomes
You should be able to create a collaborative directory that is accessible by all members of a particular group.
Log in to workstation as student using student as the password.
On workstation, run the lab perms-cli start command.
The start script creates a group called consultants and two users called consultant1 and consultant2.
[student@workstation ~]$lab perms-cli start
From
workstation, use the ssh command to log in toserveraas thestudentuser.[student@workstation ~]$ssh student@servera...output omitted...[student@servera ~]$Switch to the
rootuser usingredhatas the password.[student@servera ~]$su -Password:redhat[root@servera ~]#Use the mkdir command to create the
/home/consultantsdirectory.[root@servera ~]#mkdir /home/consultantsUse the chown command to change the group ownership of the
consultantsdirectory toconsultants.[root@servera ~]#chown :consultants /home/consultantsEnsure that the permissions of the
consultantsgroup allow its group members to create files in, and delete files from the/home/consultantsdirectory. The permissions should forbid others from accessing the files.Use the ls command to confirm that the permissions of the
consultantsgroup allow its group members to create files in, and delete files from the/home/consultantsdirectory.[root@servera ~]#ls -ld /home/consultantsdrwxr-xr-x. 2 root consultants 6 Feb 1 12:08 /home/consultantsNote that the
consultantsgroup currently does not have write permission.Use the chmod command to add write permission to the
consultantsgroup.[root@servera ~]#chmod g+w /home/consultants[root@servera ~]#ls -ld /home/consultantsdrwxrwxr-x. 2 root consultants 6 Feb 1 13:21 /home/consultantsUse the chmod command to forbid others from accessing files in the
/home/consultantsdirectory.[root@servera ~]#chmod 770 /home/consultants[root@servera ~]#ls -ld /home/consultantsdrwxrwx---. 2 root consultants 6 Feb 1 12:08 /home/consultants/
Exit the root shell and switch to the
consultant1user. The password isredhat.[root@servera ~]#exitlogout[student@servera ~]$[student@servera ~]$su - consultant1Password:redhatNavigate to the
/home/consultantsdirectory and create a file calledconsultant1.txt.Use the cd command to change to the
/home/consultantsdirectory.[consultant1@servera ~]$cd /home/consultantsUse the touch command to create an empty file called
consultant1.txt.[consultant1@servera consultants]$touch consultant1.txt
Use the ls -l command to list the default user and group ownership of the new file and its permissions.
[consultant1@servera consultants]$ls -l consultant1.txt-rw-rw-r--. 1 consultant1 consultant1 0 Feb 1 12:53 consultant1.txtEnsure that all members of the
consultantsgroup can edit theconsultant1.txtfile. Change the group ownership of theconsultant1.txtfile toconsultants.Use the chown command to change the group ownership of the
consultant1.txtfile toconsultants.[consultant1@servera consultants]$chown :consultants consultant1.txtUse the ls command with the
-loption to list the new ownership of theconsultant1.txtfile.[consultant1@servera consultants]$ls -l consultant1.txt-rw-rw-r--. 1 consultant1 consultants 0 Feb 1 12:53 consultant1.txt
Exit 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. Exit from the shell.Use the cd command to change to the
/home/consultantsdirectory. Use the echo command to addtextto theconsultant1.txtfile.[consultant2@servera ~]$cd /home/consultants/[consultant2@servera consultants]$echo "text" >> consultant1.txt[consultant2@servera consultants]$Use the cat command to verify that the text was added to the
consultant1.txtfile.[consultant2@servera consultants]$cat consultant1.txttext[consultant2@servera consultants]$Exit the shell.
[consultant2@servera consultants]$exitlogout[student@servera ~]$
Log off from
servera.[student@servera ~]$exitlogout Connection to servera closed.[student@workstation ~]$
This concludes the guided exercise.