Ainsi parlait Eric LOEW :
> Charles Goyard wrote:
> > 
> > [pounk]~$ ls -ld /var/www/
> > drwxrwsr-x   10 root     cgo          4096 dc 27 11:37 /var/www/
> 
> Oui, mais qu'en est-il des droits du groupe ?

Exemple :

[pounk]~/tst$ groups cgo
cgo : cgo cdrom audio src staff lpadmin perldev
[pounk]~/tst$ ls -l
total 8
drwxrwxr-x    2 cgo      perldev      4096 fv  4 16:30 pas_sticky/
drwxrwxr-x    2 cgo      src          4096 fv  4 16:30 sticky/
[pounk]~/tst$ chmod g+s sticky/
[pounk]~/tst$ echo bonjour > pas_sticky/plop
[pounk]~/tst$ echo bonjour > sticky/plip    
[pounk]~/tst$ ls -l pas_sticky/
total 4
-rw-r--r--    1 cgo      cgo             8 fv  4 16:32 plop
[pounk]~/tst$ ls -l sticky/    
total 4
-rw-r--r--    1 cgo      src             8 fv  4 16:32 plip

Dans le r�pertoire sticky, qui a le but SGID, le fichier n'appartient
pas � mon groupe primaire, mais au groupe du r�pertoire.

Et l� o� �a devient fort, c'est que de cette mani�re, je peux cr�er des
fichiers avec des groupes auquels je n'appartient pas !

[pounk]~/tst$ ls -l
total 8
drwxrwxr-x    2 cgo      perldev      4096 fv  4 16:32 pas_sticky/
drwxrwsr-x    2 cgo      bin          4096 fv  4 16:34 sticky/
[pounk]~/tst$ echo bonjour > sticky/plup
[pounk]~/tst$ ls -l sticky/
total 8
-rw-r--r--    1 cgo      src             8 fv  4 16:32 plip
-rw-r--r--    1 cgo      bin             8 fv  4 16:36 plup

Par contre, bien �videmment, si le user propri�taire du fichier n'est
pas moi *ET* que je ne suis pas dans le groupe du ficheir, �a ne marche
pas :

[pounk]~/tst# ls -l
total 12
drwxrwsr-x    2 root     bin          4096 fv  4 16:37 not_mine/
drwxrwxr-x    2 cgo      perldev      4096 fv  4 16:32 pas_sticky/
drwxrwsr-x    2 cgo      bin          4096 fv  4 16:36 sticky/
[pounk]~/tst$ echo bonjour > not_mine/plop
bash: not_mine/plop: Permission non accorde


Grok ?

-- 
Charles

Répondre à