Your support on Ko-Fi is much appreciated: https://ko-fi.com/csg_yt
More information on Sophos Home Antivirus: http://bit.ly/SophosHP
More information about Hostinger VPS: http://bit.ly/H-VPS
This video is based on RHEL 8. Video to cover the section ‘Create and configure set-GID directories for collaboration’ for the RHCSA (Red Hat Certified System Administrator).
More information on the required learning: http://bit.ly/rhcsa8
Notes from the video:
Add a new group:
# groupadd accounts
Check group created:
# cat /etc/group | grep accounts
Make new directory for sharing
# mkdir -p /home/shared/accounts
Update ownership so no user owns the directory but the group does:
# chown nobody:accounts /home/shared/accounts
Set the GID bit:
# chmod g+s /home/shared/accounts
Give other users no access:# chmod 770 /home/shared accounts
Confirm changes has been made:
# ls -lhtra /home/shared/
drwxr-s--- 1 nobody accounts 4.0K Jan 14 09:42 accounts
Create two new accounts to test:
# useradd -G accounts accountant1
# useradd -G accounts accountant2
SU into the one of the new accounts and check the permissions is working:
# su - accountant1
# cd /home/shared/accounts
# touch accountsfile1
# exit
SU into the other user and confirm you can edit the exisiting file with VI or nano.
# su - accountant2
Test with another user to see if only group permissions are working:
# useradd user1
# su - user1
This command should fail with permission denied:
# cd /home/shared/accounts