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
I wonder if the "nosuid" mount option can affect this. – Heptite – 2012-09-09T00:51:17.920
The filesystem in question isn't mounted with
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 – Blacklight Shining – 2012-09-09T03:53:03.8631
See also: http://serverfault.com/questions/371541/how-do-you-get-linux-to-honor-setuid-directories
– jjlin – 2012-09-09T23:21:10.1472As to implementing it, Linux sourcecode is readily available, feel free to implement this feature. Since it already exists on FreeBSD, you could quite easily copy the code over I'm sure. Of course, those bits would still have no meaning on anyone else's Linux system. – mikebabcock – 2012-09-20T03:18:18.027