[[linux_wiki:create_and_configure_set-gid_directories_for_collaboration]]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux_wiki:create_and_configure_set-gid_directories_for_collaboration [2016/03/01 02:38]
billdozor created
linux_wiki:create_and_configure_set-gid_directories_for_collaboration [2019/05/26 03:50] (current)
Line 3: Line 3:
 **General Information** **General Information**
  
-About this page/​how-to/​script+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: ​There are three departments that have data folders ​for storage(Finance, IT, and Management) ​They would like all files created ​in each of their folders ​to have the same group ownership ​for easy department file editing.+**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.
  
-The directories +----
-  * /​data/​financial-docs +
-  * /data/it-scripts +
-  * /​data/​manager-reports+
  
-The group names: +===== Solution ===== 
-  * finance + 
-  ​* ​it +Create the group "​it"​ 
-  * managers+<code bash> 
 +groupadd ​it 
 +</​code>​ 
 + 
 +\\ 
 +Create rjones and dvader 
 +<code bash> 
 +useradd rjones 
 +useradd dvader 
 +</​code>​ 
 + 
 +\\ 
 +Add the "​it"​ group as a supplementary group 
 +<code bash> 
 +usermod -aG it rjones 
 +usermod -aG it dvader 
 +</​code>​ 
 + 
 +\\ 
 +Create the "​shared-scripts"​ directory 
 +<code bash> 
 +mkdir /​home/​shared-scripts 
 +</​code>​
  
-Each group owns their respective directory+\\ 
 +Change ownership
 <code bash> <code bash>
-chown :finance /​data/​financial-docs +chown root:it /home/shared-scripts
-chown :it /data/it-scripts +
-chown :managers /​data/​manager-reports+
 </​code>​ </​code>​
  
-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 "​it"​
 <code bash> <code bash>
-chmod g+s /data/financial-docs +chmod g+s /home/shared-scripts 
-chmod g+/data/it-scripts +chmod g+/home/shared-scripts
-chmod g+s /​data/​manager-reports+
 </​code>​ </​code>​
 +  * 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 /​data/​manager-reports+
 </​code>​ </​code>​
  
 ---- ----
  
  • linux_wiki/create_and_configure_set-gid_directories_for_collaboration.txt
  • Last modified: 2019/05/26 03:50
  • (external edit)