Re,
Je crée d'abord les utilisateurs Zeus, Athena et Appollo
[root@localhost ~]# useradd Zeus
[root@localhost ~]# useradd Athena
[root@localhost ~]# useradd Apollo
J'affiche le groupe de chacun
[root@localhost ~]# groups Zeus
Zeus : Zeus
[root@localhost ~]# groups Athena
Athena : Athena
[root@localhost ~]# groups Apollo
Apollo : Apollo
Je crée un group Olimp dont aucun utilisateur fait partie
[root@localhost ~]# groupadd Olimp
Je fait les 3 memebres du groupe Olimp
[root@localhost ~]# usermod -G Olimp Zeus
[root@localhost ~]# usermod -G Olimp Athena
[root@localhost ~]# usermod -G Olimp Apollo
J'affiche le resultat
[root@localhost ~]# groups Zeus
Zeus : Zeus Olimp
[root@localhost ~]# groups Athena
Athena : Athena Olimp
[root@localhost ~]# groups Apollo
Apollo : Apollo Olimp
[root@localhost ~]#
Je crée un répertoire dont le propriétaire sera root et dedans je crée un fichier vide (la commande touch) file.txt .
[root@localhost ~]# ls -al /home/divin/
total 12
drwxr-xr-x 2 root root 4096 nov 17 22:36 .
drwxr-xr-x 11 root root 4096 nov 17 22:34 ..
-rw-r--r-- 1 root root 0 nov 17 22:36 file.txt
[root@localhost ~]#
Je modifie le group du repertoire en Olimp de façon recursive.
[root@localhost ~]# chgrp -vR Olimp /home/divin/
Changement de groupe de `/home/divin/' vers Olimp
Changement de groupe de `/home/divin/file.txt' vers Olimp
[root@localhost ~]# ls -al /home/divin/
total 12
drwxr-xr-x 2 root Olimp 4096 nov 17 22:36 .
drwxr-xr-x 11 root root 4096 nov 17 22:34 ..
-rw-r--r-- 1 root Olimp 0 nov 17 22:36 file.txt
[root@localho
Je donne access aux 3 utilisateur à ce repertoire et son contenu en lecture écriture éxécution et pour les autres j'interdit tous les access
[root@localhost ~]# chmod -vR 0770 /home/divin/
Le mode d'accès de `/home/divin/' a été modifié à 0770 (rwxrwx---).
Le mode d'accès de `/home/divin/file.txt' a été modifié à 0770 (rwxrwx---).
[root@localhost ~]#
Avec su je passe en Zeus et je vais dans /home/divin et je modifie le fichier.
[root@localhost ~]# su - Zeus
[Zeus@localhost ~]$ pwd
/home/Zeus
[Zeus@localhost ~]$ cd /home/divin/
[Zeus@localhost divin]$ pwd
/home/divin
[Zeus@localhost divin]$ cat file.txt
yyy
[Zeus@localhost divin]$
En revanche si Zeus fait chmod, il ne peux pas puisqu'il n'est pas propriètaire. En revanche il peut le supprimer puisqu'il a le droit en écriture. Pur empecher que quelqu'un supprime un fichier qui ne lui appartient on doit positionner le mod sticky bit sur le répertoire.
[Zeus@localhost divin]$ chmod -v 0771 file.txt
Échec du changement de mode de `file.txt' à 0771 (rwxrwx--x).
chmod: modification des permissions de `file.txt': Opération non permise
[Zeus@localhost divin]$ rm file.txt
[Zeus@localhost divin]$ ls -al file.txt
ls: file.txt: Aucun fichier ou répertoire de ce type
[Zeus@localhost divin]$