RHCSA Practical Lab Series β Creating a Collaborative Directory
π Lab 6: Configuring a Shared Directory with Group Ownership
π Objective
In this lab, you will:
β Create a collaborative directory /home/team
β Assign group ownership to the directory
β Set appropriate permissions to control access
β Ensure all files created inside inherit the group ownership
π Step 1: Create the Shared Directory
πΉ Use mkdir
to create the directory /home/team
:
[root@node1 ~]# mkdir /home/team
π Explanation:
mkdir /home/team
β Creates the/home/team
directory for collaborative work.
π Step 2: Set Group Ownership
πΉ Change the directoryβs group to teamgroup
:
[root@node1 ~]# chgrp teamgroup /home/team
π Explanation:
chgrp teamgroup /home/team
β Assigns group ownership of/home/team
toteamgroup
.- This ensures that only members of
teamgroup
can access the directory.
πΉ Verify group ownership:
[root@node1 ~]# ls -ld /home/team
πΉ Expected Output:
drwxr-xr-x 2 root teamgroup 4096 Mar 28 10:00 /home/team
β
If teamgroup
appears in the output, the group ownership is set correctly.
π Step 3: Configure Group Permissions
πΉ Set permissions to allow group members to create, edit, and delete files:
[root@node1 ~]# chmod 2770 /home/team
π Explanation:
chmod 2770 /home/team
β Grants:- 2 (SetGID bit) β Ensures all files inside inherit the
teamgroup
group ownership. - 7 (rwx for owner) β Full access for the directory owner (root).
- 7 (rwx for group) β Full access for
teamgroup
members. - 0 (no access for others) β No access for non-group users.
- 2 (SetGID bit) β Ensures all files inside inherit the
πΉ Verify permissions:
[root@node1 ~]# ls -ld /home/team
πΉ Expected Output:
drwxrws--- 2 root teamgroup 4096 Mar 28 10:00 /home/team
β
The s
in drwxrws---
confirms that the SetGID
bit is active.
π Step 4: Verify SELinux Context (Optional but Recommended)
πΉ Check the SELinux context for /home/team
:
[root@node1 ~]# ls -Z /home
π Expected Output (partial):
drwxrws--- root teamgroup system_u:object_r:home_root_t:s0 team
β
If the SELinux context is home_root_t
, it is correct.
π Troubleshooting:
If SELinux prevents access, restore the default context:
[root@node1 ~]# restorecon -Rv /home/team
β Final Summary
β Created a shared directory /home/team
β Set group ownership to teamgroup
β Configured permissions with the SetGID
bit
β Verified SELinux context to ensure smooth access
π Next Lab: Setting Up an NTP Client Using Chrony
π© Subscribe for more RHCSA exam labs and hands-on tutorials! π