This is an old revision of the document!
Create And Configure Set-gid Directories For Collaboration
General Information
Team collaboration directories.
Scenario
When files are created in a directory with set-GID, the new files inherit the group ownership of that directory.
Example scenario: The IT department would like to have a directory for its shared scripts amongst team members in /home/. They want the directory called “shared-scripts” and their group name to be “it”. All files created should be owned by “it” and no other users are allowed access. Add two of the members “rjones” and “dvader” to the group for them to test. Add them so that the “it” group is not their primary group.
Solution
Create the group “it”
groupadd it
Create rjones and dvader
useradd rjones useradd dvader
Add the “it” group as a supplementary group
usermod -aG it rjones usermod -aG it dvader
Create the “shared-scripts” directory
mkdir /home/shared-scripts
Change ownership
chown root:it /home/shared-scripts
Change the group set-GID bit so all files created will be owned by “it”
chmod g+s /home/shared-scripts chmod g+w /home/shared-scripts
- Also give them write access
Remove Permissions from all others
chmod o-rwx /home/shared-scripts