1834909 Members
2595 Online
110071 Solutions
New Discussion

setuid on directory?

 
W.C. Epperson
Trusted Contributor

setuid on directory?

Is there any significance to the setuid bit being set on a directory? It doesn't appear to have any impact on anything.
"I have great faith in fools; self-confidence, my friends call it." --Poe
3 REPLIES 3
Rodney Hills
Honored Contributor

Re: setuid on directory?

If you do a man chmod, you will find the following-

If the sticky bit is set on a directory, files inside the directory
may be renamed or removed only by the owner of the file, the owner of
the directory, or the superuser (even if the modes of the directory
would otherwise allow such an operation).

Hope this helps...

-- Rod Hills
There be dragons...
George A Bodnar
Trusted Contributor

Re: setuid on directory?

The setuid bit (g+s or u+s) on a directory will force files created in that directory to have the owner (u+s) and/or group (g+s) of the directory.

This could be useful to say force all files into a certain group or username regardless of who writes into that directory.
W.C. Epperson
Trusted Contributor

Re: setuid on directory?

Rodney: That's consistent with my recollection about the sticky bit, but that text is not in my chmod manpages. Anyway, this is the "s", not the "t".

George: I thought that was the way in worked in my SCO Unix days, but by experiment, it doesn't work that way on my 10.20 or 11.0 boxen.
"I have great faith in fools; self-confidence, my friends call it." --Poe