Setting Up Collaborative Permissions for the Dev Team
Note: Make sure you have completed Step 2 first, which sets the ownership of all project directories (including src) to dev_lead:developers. This step builds upon those ownership settings.
The development team needs to collaborate effectively within the ~/project/phoenix_project/src directory. To ensure smooth collaboration, any new file or directory created inside src should automatically belong to the developers group, not the primary group of the user who created it.
Tasks
- Set a special permission on the
~/project/phoenix_project/src directory that forces all new files and subdirectories created within it to inherit the group ownership from the src directory itself (which is developers).
Requirements
- The solution must ensure new files in
~/project/phoenix_project/src are automatically owned by the developers group.
- You must use the
chmod command to set this special permission.
- You may need to use
sudo to set permissions on directories owned by other users.
Hints
- This special permission is called the "set group ID" or
setgid bit.
- You can apply the
setgid bit using either symbolic (g+s) or numeric notation.
- In numeric notation, the
setgid bit has a value of 2. It is placed before the standard three permission digits (e.g., 2770).
Examples
After completing this task, you should see something like:
$ ls -ld ~/project/phoenix_project/src/
drwxrws--- 2 dev_lead developers 6 Sep 3 16:00 ~/project/phoenix_project/src/
The s in the group execute position indicates the setgid bit is set and the group has execute permission. Now when you create a new file:
$ touch ~/project/phoenix_project/src/new_file.txt
$ ls -l ~/project/phoenix_project/src/new_file.txt
-rw-rw---- 1 dev_lead developers 0 Sep 3 16:05 new_file.txt
Notice that the new file automatically belongs to the developers group, even if you are logged in as a different user. This ensures collaborative work within the development team while maintaining proper group ownership.
The permissions show:
- Owner (
dev_lead) has read and write permissions
- Group (
developers) has read and write permissions
- Others have no permissions
- The lowercase
s in the group execute position indicates the setgid bit is set and the group has execute permission