If the group of
foo, and I run
chmod g+s /some/dir
...then any child of
/some/dir will also have group
Crucially, however, a new subdirectory
/some/dir/subdir will not have
g+s (although, as just stated, it its group will be
How can I ensure that all descendant subdirectories of
/some/dir not only inherit the group
foo, but also inherit the
FWIW, my umask is
002, the filesystem is nfs, and the options according to
UPDATE: I now understand the source of my confusion: sometimes changing a directory's group (with
chgrp) has the effect of disabling a previously enabled setgid bit. E.g.
% rm -rf /some/dir % mkdir -p /some/dir % chmod g+s /some/dir % ls -ld /some/dir drwxrwsr-x 2 jones jones 0 Nov 7 07:13 /some/dir % chgrp foo /some/dir % ls -ld /some/dir drwxrwxr-x 2 jones jones 0 Nov 7 07:13 /some/dir
(Note that the setgid bit ends up unset.)
As I said, this happens only sometimes. For example, if I repeat the same sequence above, but I run the
chgrp command under
sudo, then the
setgid bit remains set at the end.
This effect of
chgrp on the permissions is what threw me off.