3
1
Here's the scenario: I'm using Ubuntu Linux (12.10, if it matters), and I've got a directory whose permissions are thus:
drwxrws--- paul www-data myfolder/
You can see the setgid
bit is set. If I change any permissions on this folder (e.g., chmod o+x myfolder
) it unsets the setgid
bit.
According to chmod
's manpage:
chmod preserves a directory's
set-user-ID
andset-group-ID
bits unless you explicitly specify otherwise.
Elsewhere, it says that it unsets the setgid
bit if the file's group doesn't match the user's effective group ID, but only on regular files (i.e., not folders). So, because my group is paul
rather than www-data
, I'd expect the above to happen if myfolder/
were a regular file, but it ain't -- it's a directory.
So either I'm understanding the manual wrong, or chmod
is not obeying its own instructions. Does anyone know which?