[KLUG Members] Directory Permissions Questions

Adam Williams members@kalamazoolinux.org
23 Oct 2002 07:11:21 -0400


>Aha!  That will do.  Thanks!!!
>>While not exactly the same I know that in Linux anyway, turning on the
>>setgid bit for a directory makes sure that any newly created files are
>>owned by whatever group owns the directory.  I thought that maybe the
>>setuid bit would do what you wanted but after a little bit of
>>experimentation it isn't.  I can't figure out what a setuid directry
>>acutally does.

http://www.linuxpowered.com/html/editorials/file.html#sticky

The Sticky Bit
If a user has write permission on a directory he can rename and remove
files on that directory even if those files not belong to him. How can
we prevent this? The owner of a directory can set the directory's
"sticky bit", octal value 1000, which will give the rename and remove
permissions of any file in that directory to the fileowner, the
directory owner, and the superuser (in this order).

If you examine your / directory using the command ls -l, you will notice
your /tmp directory has the sticky bit on.

drwxrwxrwt    4 root      root         50176 Apr 20 04:50 tmp/

This allow different users to use this directory for temporary files,
when only the file owner can delete his files (the directory owner for
/tmp is the root user and he can also delete files). This prevents other
users from deleting temporary files created by others and harming their
work.