Sharing data: Difference between revisions

Jump to navigation Jump to search
s/SUID/SGID/
(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 User ID (SUID) === <!--T:16-->
=== Set Group ID (SGID) === <!--T:16-->
When creating files and directories within a parent directory there are cases where it is very useful to be able to match the owner or group of the new files or directories to the parent directory's owner or group automatically. By setting the Set User ID (SUID) permission on a directory, files and directories created in that directory will inherit that owner or group. The storage quotas on Cedar and Graham project spaces are enforced by group. Depending on a file's group it will count towards a different storage quota. By setting the SUID of a directory's group any files created in it will have the same group as the parent directory and will count towards the same quota as that parent directory. To illustrate the use of SUID lets walk through an example.
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 we can set the SUID permission on the parent directory.
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 SUID set it will have the same group as the parent folder and also have its SUID set.
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> (capital-S) and <code>s</code>. The capital-S indicates that execute permissions have been removed from the directory but the SUID is still in place. It can be easy to miss this and may result in unexpected permissions problems, such as others in the group not being able to access files within your directory.
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/
Bureaucrats, cc_docs_admin, cc_staff
2,879

edits

Navigation menu