Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux_wiki:create_and_configure_set-gid_directories_for_collaboration [2016/02/29 21:38] billdozor created |
linux_wiki:create_and_configure_set-gid_directories_for_collaboration [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 3: | Line 3: | ||
**General Information** | **General Information** | ||
- | About this page/ | + | Team collaboration directories. |
---- | ---- | ||
+ | |||
+ | ===== Scenario ===== | ||
When files are created in a directory with set-GID, the new files inherit the group ownership of that directory. | When files are created in a directory with set-GID, the new files inherit the group ownership of that directory. | ||
- | Example scenario: | + | **Example scenario**: The IT department would like to have a directory |
- | The directories | + | ---- |
- | * / | + | |
- | * /data/it-scripts | + | |
- | * / | + | |
- | The group names: | + | ===== Solution ===== |
- | * finance | + | |
- | | + | Create the group " |
- | * managers | + | <code bash> |
+ | groupadd | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | Create rjones and dvader | ||
+ | <code bash> | ||
+ | useradd rjones | ||
+ | useradd dvader | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | Add the " | ||
+ | <code bash> | ||
+ | usermod -aG it rjones | ||
+ | usermod -aG it dvader | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | Create the " | ||
+ | <code bash> | ||
+ | mkdir / | ||
+ | </ | ||
- | Each group owns their respective directory | + | \\ |
+ | Change ownership | ||
<code bash> | <code bash> | ||
- | chown :finance / | + | chown root:it /home/shared-scripts |
- | chown :it /data/it-scripts | + | |
- | chown :managers / | + | |
</ | </ | ||
- | Change the group set-GID bit to achieve the requirement in the scenario | + | \\ |
+ | Change the group set-GID bit so all files created will be owned by " | ||
<code bash> | <code bash> | ||
- | chmod g+s /data/financial-docs | + | chmod g+s /home/shared-scripts |
- | chmod g+s /data/it-scripts | + | chmod g+w /home/shared-scripts |
- | chmod g+s / | + | |
</ | </ | ||
+ | * Also give them write access | ||
+ | \\ | ||
Remove Permissions from all others | Remove Permissions from all others | ||
<code bash> | <code bash> | ||
- | chmod o-rwx /data/financial-docs | + | chmod o-rwx /home/shared-scripts |
- | chmod o-rwx /data/it-scripts | + | |
- | chmod o-rwx / | + | |
</ | </ | ||
---- | ---- | ||