RHCSA Rapid Track
Performance Checklist
In this lab, you will configure permissions on files and set up a directory that users in a particular group can use to conveniently share files on the local file system.
Outcomes
You should be able to:
Create a directory where users can work collaboratively on files.
Create files that are automatically assigned group ownership.
Create files that are not accessible outside of the group.
Log in to workstation as student using student as the password.
On workstation, run the lab perms-review start command.
The command runs a start script that determines if serverb is reachable on the network.
The script also creates the techdocs group and three users named tech1, tech2, and database1.
[student@workstation ~]$lab perms-review start
Use the
sshcommand to log in toserverbas thestudentuser. Switch torootonserverbusingredhatas the password.Create a directory called
/home/techdocs.Change the group ownership of the
/home/techdocsdirectory to thetechdocsgroup.Verify that users in the
techdocsgroup cannot currently create files in the/home/techdocsdirectory.Use the
sucommand to switch to thetech1user.[root@serverb ~]#su - tech1[tech1@serverb ~]$Use
touchto create a file namedtechdoc1.txtin the/home/techdocsdirectory.[tech1@serverb ~]$touch /home/techdocs/techdoc1.txttouch: cannot touch '/home/techdocs/techdoc1.txt': Permission deniedNote
Note that even though the
/home/techdocsdirectory is owned bytechdocsandtech1is part of thetechdocsgroup, it is not possible to create a new file in that directory. This is because thetechdocsgroup does not have write permission. Use thels -ldcommand to show the permissions.[tech1@serverb ~]$ls -ld /home/techdocs/drwxr-xr-x. 2 root techdocs 6 Feb 5 16:05 /home/techdocs/
Set permissions on the
/home/techdocsdirectory. On the/home/techdocsdirectory, configure setgid (2), read/write/execute permissions (7) for the owner/user and group, and no permissions (0) for other users.Exit from the
tech1user shell.[tech1@serverb ~]$exitlogout[root@serverb ~]#Use the
chmodcommand to set the group permission for the/home/techdocsdirectory. On the/home/techdocsdirectory, configure setgid (2), read/write/execute permissions (7) for the owner/user and group, and no permissions (0) for other users.[root@serverb ~]#chmod 2770 /home/techdocs
Verify that the permissions are set properly.
Confirm that users in the
techdocsgroup can now create and edit files in the/home/techdocsdirectory. Users not in thetechdocsgroup cannot edit or create files in the/home/techdocsdirectory. Userstech1andtech2are in thetechdocsgroup. Userdatabase1is not in that group.Switch to the
tech1user. Usetouchto create a file calledtechdoc1.txtin the/home/techdocsdirectory. Exit from thetech1user shell.[root@serverb ~]#su - tech1[tech1@serverb ~]$touch /home/techdocs/techdoc1.txt[tech1@serverb ~]$ls -l /home/techdocs/techdoc1.txt-rw-rw-r--. 1 tech1 techdocs 0 Feb 5 16:42 /home/techdocs/techdoc1.txt[tech1@serverb ~]$exitlogout[root@serverb ~]#Switch to the
tech2user. Use theechocommand to add some content to the/home/techdocs/techdoc1.txtfile. Exit from thetech2user shell.[root@serverb ~]#su - tech2[tech2@serverb ~]$cd /home/techdocs[tech2@serverb techdocs]$echo "This is the first tech doc." > techdoc1.txt[tech2@serverb techdocs]$exitlogout[root@serverb ~]#Switch to the
database1user. Use theechocommand to append some content to the/home/techdocs/techdoc1.txtfile. Notice that you will get aPermission Deniedmessage. Use thels -lcommand to confirm thatdatabase1does not have access to the file. Exit from thedatabase1user shell.The following
echocommand is very long and should be entered on a single line.[root@serverb ~]#su - database1[database1@serverb ~]$echo "This is the first tech doc." >> /home/techdocs/techdoc1.txt-bash: /home/techdocs/techdoc1.txt: Permission denied[database1@serverb ~]$ls -l /home/techdocs/techdoc1.txtls: cannot access '/home/techdocs/techdoc1.txt': Permission denied[database1@serverb ~]$exitlogout[root@serverb ~]#
Modify the global login scripts. Normal users should have a umask setting that prevents others from viewing or modifying new files and directories.
Determine the umask of the
studentuser. Use thesu - studentcommand to switch tostudentlogin shell. When done exit from the shell.[root@serverb ~]#su - student[student@serverb ~]$umask0002[student@serverb ~]$exitlogout[root@serverb ~]#Create the
/etc/profile.d/local-umask.shfile with the following content to set the umask to007for users with a UID greater than199and with a username and primary group name that match, and to022for everyone else:# Overrides default umask configuration if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then umask 007 else umask 022 fiLog out of the shell and log back in as
studentto verify that global umask changes to007.[root@serverb ~]#exitlogout[student@serverb ~]$exitlogout Connection to serverb closed.[student@workstation ~]$ssh student@serverb...output omitted...[student@serverb ~]$umask0007
Log off from
serverb.[student@serverb ~]$exitlogout Connection to serverb closed.
This concludes the lab.