File Write Permission Rules

Casper H.S. Dik dik at uva.UUCP
Mon Feb 13 02:26:29 AEST 1989


In article <950 at philmds.UUCP} leo at philmds.UUCP (Leo de Wit) writes:
}In article <632 at uva.UUCP> dik at uva.UUCP (Casper H.S. Dik) writes:
}|If you have 4.3BSD, SunOS 4.x etc the solution is even more obvious:
}|Set the sticky bit on your directory. This prevents people other than
}|the owner of the file or the owner of the directory in which the link
}|resides to unlink or rename the link.
}
}A pity (is it really?) that ordinary users are not allowed to set
}'sticky mode', this makes it hard to use by anyone but root. I fail to
}understand what the possibility of unlinking has to do with sticky bits
}(but then, you can fill me in); I thought that a sticky bit keeps a
}file on the swap disk, once it is loaded.
}

Well it used to be only effective on executables.
But with 4.3BSD(?) came the sticky bit for directories.

Every user can set the sticky bit of a directory.

Apparently someone somewhere noticed an unused bit in the mode word
for directories. (With SunOS 4.x, I understand, you can even make
directories setuid or setgid)

The name sticky still is appropriate because files 'stick' to 
the directory they are in.

This feature is new, so few people know about it (I think).

sticky(8) from SunOS 3.5 says:

     A directory for which the  `sticky  bit'  is  set  restricts
     deletion of files it contains.  A file in a sticky directory
     may only be removed or renamed by a user who has write  per-
     mission on the directory, and either owns the file, owns the
     directory, or is the super-user.  This is useful for  direc-
     tories  such  as  /tmp, which must be publicly writable, but
     which should deny users  access  to  arbitrarily  delete  or
     rename the files of others.

     Any user may create a sticky directory.  Only the super-user
     can set the sticky bit on a non-directory file.




}	Leo.


--cd
----------------------------------------------------------------------------
Casper H.S. Dik
University of Amsterdam     |		      dik at uva.uucp
The Netherlands             |                 ...!uunet!mcvax!uva!dik



More information about the Comp.unix.questions mailing list