RHCSA Practical Lab Series – Creating a Collaborative Directory

Expertise in Cloud, Networking & DevOps
Photo by Markus Spiske / Unsplash

πŸ” 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 to teamgroup.
  • 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.

πŸ”Ή 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.


πŸ”Ή 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! πŸš€


Read more