RHCSA Rapid Track
In this lab, you will add a named group access control list (ACL) and a named user ACL to an existing share folder and its content. You will set up default ACLs to ensure future files and directories get the correct permissions.
| Resources: | |
|---|---|
| Files: |
/shares/steamies/*,
/shares/steamies/display_engines.sh
|
| Machines: | serverX |
Outcomes
Members of the
sodorgroup will have the same access permissions as thecontrollergroup on thesteamiesdirectory, exceptjames, who has no access.Existing files and directories will be updated to reflect the new
sodorandjamesACL permissions.New files and directories will automatically get the correct ACL and file permissions.
Reset your serverX system.
Log into and set up your server system.
[student@serverX ~]$lab acl setupOpen a terminal.
Switch to
rootusing sudo -i.
Student is a controller for the Sodor Island
Rail network. There is a properly configured share directory located at
/shares/steamies that hosts files detailing rostering, steam engines,
etc.
Currently, only members of the controller group have access to this
directory, but it has been decided that members of the sodor group would
benefit from full access to this directory.
James, a member of the sodor group, has caused chaos and
confusion on many occasions, so he is to be denied access to the
directory, at least until he shows that he is a really useful
engine.
Your task is to add appropriate ACLs to the directory and its contents, so that members
of the sodor group have full access, but deny user james any
access. Make sure that future files and directories stored in
/shares/steamies get appropriate ACLs applied.
Important information:
controllergroup:studentsodorgroup:thomas,jamesThere is a subdirectory called
enginesand numerous files to test the ACLs. Also, there is an executable script you can test.Thomas and James have their passwords set to redhat.
All changes should occur to directory
steamiesand its files; do not adjust thesharesdirectory.
Add the named ACLs to the
steamiesdirectory and all of its content.Use setfacl to recursively update the
steamiesdirectory, granting thesodorgroup read, write, and conditional execute permissions.[root@serverX ~]#setfacl -Rm g:sodor:rwX /shares/steamies-Rrecursive,-mmodify/add,:rwXread/write/eXecute (but only on directories and existing executables)Use setfacl to recursively update the
steamiesdirectory, denying the userjamesfrom thesodorgroup any access.[root@serverX ~]#setfacl -Rm u:james:- /shares/steamies-Rrecursive,-mmodify/add,:-no permissions
Add the named ACLs as default ACLs to support future file and directory additions.
Use setfacl to add a default access rule for the
sodorgroup. Grant read, write, and execute permissions on thesteamiesdirectory.[root@serverX ~]#setfacl -m d:g:sodor:rwx /shares/steamies-mmodify/add,d:gdefault group,:rwxread/write/execute (needed for proper subdirectory creation and access)Use setfacl to add a default access rule for the user
james. Deny all access to thesteamiesdirectory.[root@serverX ~]#setfacl -m d:u:james:- /shares/steamies-mmodify/add,d:udefault user,:-no permissions
Verify your ACL changes.
Thomas should be able to read any file, create a new directory with a new file in it, and execute the
display_engines.shscript.James should not be able to read, write, or execute any file; this includes being unable to list the directory contents.
Use sudo -i -u
userto switch to your test users. Use exit or Ctrl+D to leave the test user shell.[root@serverX ~]#exit[student@serverX ~]$sudo -i -u thomas[thomas@serverX ~]$cd /shares/steamies/Use cat to check that Thomas can read a file.
[thomas@serverX steamies]$cat roster.txtJames - Shunting at Brendam docks Percy - Overnight mail run Henry - Flying Kipper run Thomas - Annie and Clarabel, Knapford lineUse
display_engines.shto check that Thomas can execute a script.[thomas@serverX steamies]$./display_engines.shThey're two, they're four, they're six, they're eight ... Edward wants to help and share ... Toby, well let's say, he's squareUse mkdir to create a directory as Thomas.
Use echo to create a file in the new directory as Thomas.
Switch back to
studentwhen you are finished.[thomas@serverX steamies]$mkdir tidmouth[thomas@serverX steamies]$echo "toot toot" > tidmouth/whistle.txt[thomas@serverX steamies]$exitUse cd to try and change into the directory as James, and also try ls to list the directory. Both commands should fail with
Permission denied.You could try one or more of the commands Thomas issued, but as James, to further verify his lack of access. Try prefixing each file with the full path,
/shares/steamies, because you cannot cd into the directory.Switch back to
studentwhen you are finished testingjames.[student@serverX ~]$sudo -i -u james[james@serverX ~]$cd /shares/steamies/-bash: cd: /shares/steamies/: Permission denied[james@serverX ~]$ls /shares/steamies/ls: cannot open directory /shares/steamies: Permission denied[james@serverX ~]$cat /shares/steamies/roster.txtcat: /shares/steamies/roster.txt: Permission denied[james@serverX ~]$exitUse getfacl to see all the ACLs on
/shares/steamiesand the ACLs on/shares/steamies/tidmouth.Note
Use newgrp controller to switch student to the controller group.
The lab acl setup script adds controller as a supplementary group to student; however, unless you have restarted the shell prior to this step, then the current shell does not yet recognize the new membership and getfacl on
tidmouthwill getPermission denied.[student@serverX ~]$newgrp controller[student@serverX ~]$getfacl /shares/steamiesgetfacl: Removing leading '/' from absolute path names # file: shares/steamies/ # owner: root # group: controller # flags: -s- user::rwx user:james:--- group::rwx group:sodor:rwx mask::rwx other::--- default:user::rwx default:user:james:--- default:group::rwx default:group:sodor:rwx default:mask::rwx default:other::---[student@serverX ~]$getfacl /shares/steamies/tidmouthgetfacl: Removing leading '/' from absolute path names # file: shares/steamies/tidmouth # owner: thomas # group: controller # flags: -s- user::rwx user:james:--- group::rwx group:sodor:rwx mask::rwx other::--- default:user::rwx default:user:james:--- default:group::rwx default:group:sodor:rwx default:mask::rwx default:other::---