gandalf@csli.stanford.edu (Juergen Wagner) (12/14/88)
The manual page for chgrp(1) says: [SunOS 4.0] chgrp changes the group-ID of the filenames given as argu- ments to group. ... -R Recursive. chgrp descends through the directory, and any subdirectories, setting the specified group-ID as it proceeds. When symbolic links are encountered, their group is changed, but they are not traversed. The manual page for chmod(1) says: [SunOS 4.0] Change the permissions (mode) of a file or files. Only the owner of a file (or the super-user) may change its mode. ... -R Recursively descend through directory arguments, set- ting the mode for each file as described above. When symbolic links are encountered, their mode is not changed and they are not traversed. Now, try the following: peano:work(17). touch x peano:work(18). ln -s x y peano:work(19). ls -lg x y -rw-r--r-- 1 wagner parc 0 Dec 2 13:29 x lrwxrwxrwx 1 wagner parc 1 Dec 2 13:29 y -> x peano:work(20). chgrp kmem y peano:work(21). chmod 770 y peano:work(22). ls -lg x y -rwxrwx--- 1 wagner parc 0 Dec 2 13:29 x lrwxrwxrwx 1 wagner kmem 1 Dec 2 13:29 y -> x peano:work(23). This shows that chmod changes the protection of the file (as it should), but chgrp changes the group of the link (shouldn't it change the file's group?). [[ Well, perhaps it should, but what does that have to do with the -R option? --wnl ]] Juergen Wagner gandalf@csli.stanford.edu wagner@arisia.xerox.com
guy@uunet.uu.net (Guy Harris) (12/30/88)
>This shows that chmod changes the protection of the file (as it should), >but chgrp changes the group of the link (shouldn't it change the file's >group?). This dates back to 4.2BSD. The "chmod" system call follows links, but the "chown" system call doesn't. I remember hearing various reasons why this was done, but I don't remember them sufficiently well to reconstruct them.