STICKY(8)

NAME
sticky - executable files with persistent text and append-only directories

DESCRIPTION
The sticky bit (file mode bit 01000, see chmod(2)) is used to indicate special treatment for certain executable files and directories.

STICKY TEXT EXECUTABLE FILES
Normally, the text pages of a sharable executable file remain cached in memory long after all instances of a text image exit. The system's representation of shared text is reused on a least recently used basis (the system reuses the oldest text pages first). When the `sticky bit', is set on a sharable executable file, the system's representation of the shared text is never reused.

Sharable files are created using the -n and -z options of ld(1).

To replace a sticky executable that has been used:

(1) Create a new file with the same name. Note that if the file is being executed by any process, writing is prevented; it suffices to simply remove the file and then rewrite it, being careful to reset the owner and mode with chmod(2) and chown(2) (see install(1)).

(2) Set the sticky bit again.

Only the super-user can set the sticky bit on a sharable executable file.

STICKY DIRECTORIES
A directory whose `sticky bit' is set becomes an append-only directory, or, more accurately, a directory in which the deletion of files is restricted. A file in a sticky directory may only be removed or renamed by a user if the user has write permission for the directory and the user is the owner of the file, the owner of the directory, the super-user, or the user has write permission on the file. This feature is usefully applied to directories such as /tmp which must be publicly writable but should deny users the license to arbitrarily delete or rename each others' files.

Any user may create a sticky directory. See chmod(1) for details about modifying file modes.

NOTE
Sticky executables are largely unnecessary on a virtual-memory machine, since text pages are normally cached as long as possible after all instances of a text image exit.

SEE ALSO
chmod(2), chown(2), install(1)