A bit late to the party, but in case future readers stumble across this ;)
As stated by others, on a standard OS-X filesystem the setUID for directories gets ignored - and there doesn't seem to be an easy way around this (mount -o
.... or what not). As so often, the man page actually does not comply with the OS-X behaviour it literally states:
4000 (the set-user-ID-on-execution bit) [...] Directories with the set-user-id bit set will force all files and sub-directories created in them to be owned by the directory owner and not by the uid of the creating process [...]
but it also lists a possibility to achieve the same effect without giving up the original ownership. Linux uses '[g/]setfacls' for similar effects (they're permissions not really visible at first glance, so can sometime be a nuisance).
As to the 'how can I achieve similar effects', read the entire man page and fiddle with:
chmod +a 'guest allow read,write,delete,add_file,add_subdirectory,file_inherit,directory_inherit' ./[DIRECTORY]
you can check via
ls -le
if all looks fine. Further options include inserting rules at specific positions, removing or replacing specific rules. The two noteworthy options here are "file_inherit
and directory_inherit
" allowing the rules to be attached to a new directory/file.
I'm not really fond of using setUID, but setGID comes in very handy on fileservers where simply setting the 'main' group doesn't work or clients have filemasks disallowing group write. That would be solved by:
chmod +a 'mygroup allow read,write,delete,add_file,add_subdirectory,file_inherit,directory_inherit' /fileserver/groupfolders/mygroup
nosuid
—though there's another one (a ramdisk,/dev/shm
) which /is/ mountednosuid
, and it seems to treat thesetuid
bit exactly the same way. 6_9