Bureaucrats, cc_docs_admin, cc_staff
2,879
edits
(Marked this version for translation) |
(s/SUID/SGID/) |
||
Line 62: | Line 62: | ||
In the context of the project space, the directory owner will be the PI who sponsors the roles of the students and collaborators. | In the context of the project space, the directory owner will be the PI who sponsors the roles of the students and collaborators. | ||
=== Set | === Set Group ID (SGID) === <!--T:16--> | ||
When creating files and directories within a parent directory | When creating files and directories within a parent directory it is often useful to match the group-ownership of the new files or directories to the parent directory's owner or group automatically. This is key to the operation of the [[Project layout|Project]] filesystems at Graham and Cedar, for example, since storage quotas in Project spaces are enforced by group. | ||
If Set Group ID (SGID) permission is turned on for a directory, new files and directories in that directory will be created with the same group-ownership as the directory. To illustrate the use of SGID let us walk through an example. | |||
<!--T:17--> | <!--T:17--> | ||
Line 82: | Line 84: | ||
-rw-rw-r-- 1 someuser someuser 0 Oct 13 19:38 test01.txt | -rw-rw-r-- 1 someuser someuser 0 Oct 13 19:38 test01.txt | ||
</source> | </source> | ||
If we want a newly created file to belong to the same group as the parent folder | If we are in <code>/project</code> this is probably not what we want. We want a newly created file to belong to the same group as the parent folder. Set the SGID permission on the parent directory like so: | ||
<source lang="console"> | <source lang="console"> | ||
[someuser@server]$ chmod g+s dirTest | [someuser@server]$ chmod g+s dirTest | ||
Line 95: | Line 97: | ||
-rw-rw-r-- 1 someuser def-someuser 0 Oct 13 19:39 test02.txt | -rw-rw-r-- 1 someuser def-someuser 0 Oct 13 19:39 test02.txt | ||
</source> | </source> | ||
If we create a directory inside a directory with the | If we create a directory inside a directory with the SGID set it will have the same group as the parent folder and also have its SGID set. | ||
<source lang="console"> | <source lang="console"> | ||
[someuser@server]$ mkdir dirTest/dirChild | [someuser@server]$ mkdir dirTest/dirChild | ||
Line 103: | Line 105: | ||
drwxrwsr-x 1 someuser def-someuser 0 Oct 13 19:39 dirChild | drwxrwsr-x 1 someuser def-someuser 0 Oct 13 19:39 dirChild | ||
</source> | </source> | ||
Finally it can be important to note the difference between a <code>S</code> ( | Finally it can be important to note the difference between a <code>S</code> (upper-case S) and <code>s</code>. The upper-case S indicates that execute permissions have been removed from the directory but the SGID is still in place. It can be easy to miss this and may result in unexpected problems, such as others in the group not being able to access files within your directory. | ||
<source lang="console"> | <source lang="console"> | ||
[someuser@server]$ chmod g-x dirTest/ | [someuser@server]$ chmod g-x dirTest/ |