40,120
edits
(Created page with "Il est désactivé par la commande {{Commande|chmod -t <directory name>}} ou en octal, {{Commande|chmod 0774 <directory name>}} Pour l'espace projet, le propriétaire du répe...") |
(Updating to match new version of source page) |
||
Line 57: | Line 57: | ||
{{Commande|chmod 0774 <directory name>}} | {{Commande|chmod 0774 <directory name>}} | ||
Pour l'espace projet, le propriétaire du répertoire est le chercheur principal qui parraine les étudiants et les collaborateurs. | Pour l'espace projet, le propriétaire du répertoire est le chercheur principal qui parraine les étudiants et les collaborateurs. | ||
=== Set User ID (SUID) === | |||
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. | |||
Start by checking the groups that <code>someuser</code> belongs to with the <code>groups</code> command. | |||
<source lang="console"> | |||
[someuser@server]$ groups | |||
someuser def-someuser | |||
</source> | |||
<code>someuser</code> belongs to two groups <code>someuser</code> and <code>def-someuser</code>. In the current working directory there is a directory which belongs to the group <code>def-someuser</code>. | |||
<source lang="console"> | |||
[someuser@server]$ ls -l | |||
drwxrwx--- 2 someuser def-someuser 4096 Oct 13 19:39 testDir | |||
</source> | |||
If we create a new file in that directory we can see that it is created belonging to <code>someuser</code>'s default group <code>someuser</code>. | |||
<source lang="console"> | |||
[someuser@server]$ touch dirTest/test01.txt | |||
[someuser@server]$ ls -l dirTest/ | |||
-rw-rw-r-- 1 someuser someuser 0 Oct 13 19:38 test01.txt | |||
</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. | |||
<source lang="console"> | |||
[someuser@server]$ chmod g+s dirTest | |||
[someuser@server]$ ls -l | |||
drwxrws--- 2 someuser def-someuser 4096 Oct 13 19:39 dirTest | |||
</source> | |||
Notice that the <code>x</code> permission on the group permissions has changed to an <code>s</code>. Now newly created files in <code>dirTest</code> will have the same group as the parent directory. | |||
<source lang="console"> | |||
[someuser@server]$ touch dirTest/test02.txt | |||
[someuser@server]$ ls -l dirTest | |||
-rw-rw-r-- 1 someuser someuser 0 Oct 13 19:38 test01.txt | |||
-rw-rw-r-- 1 someuser def-someuser 0 Oct 13 19:39 test02.txt | |||
</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. | |||
<source lang="console"> | |||
[someuser@server]$ mkdir dirTest/dirChild | |||
[someuser@server]$ ls -l dirTest/ | |||
-rw-rw-r-- 1 someuser someuser 0 Oct 13 19:38 test01.txt | |||
-rw-rw-r-- 1 someuser def-someuser 0 Oct 13 19:39 test02.txt | |||
drwxrwsr-x 1 someuser def-someuser 0 Oct 13 19:39 dirChild | |||
</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. | |||
<source lang="console"> | |||
[someuser@server]$ chmod g-x dirTest/ | |||
[someuser@server]$ ls -l | |||
drwxrS--- 3 someuser def-someuser 4096 Oct 13 19:39 dirTest | |||
</source> | |||
== Listes de contrôle d'accès == | == Listes de contrôle d'accès == |