Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sticky(8) — SunOS 4.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1V)

ld(1)

chmod(2)

chown(2)

mkdir(2)

open(2V)

STICKY(8)  —  MAINTENANCE COMMANDS

NAME

sticky − 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

While the sticky bit is set on a sharable executable file, the text of that file will not be removed from the system swap area.  Thus the file does not have to be fetched from the file system upon each execution.  As long as a copy remains in the swap area, the original text cannot be overwritten in the file system, nor can the file be deleted.  Directory entries can be removed so long as one link remains. 

Sharable executable files are made by the −n and −z options of ld(1). 

To replace a sticky file that has been used:

1.  Clear the sticky bit with chmod(1V). 

2.  Execute the old program to flush the swapped copy.  This can be done safely even if others are using it. 

3.  Overwrite the sticky file.  If the file is being executed by any process, writing will be prevented; it suffices to simply remove the file and then rewrite it, being careful to reset the owner and mode with chmod and chown(2). 

4.  Set the sticky bit once again, if still needed. 

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

Sticky Directories

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 permission on the directory, and either owns the file, owns the directory, or is the super-user.  This is useful for directories such as /tmp, which must be publicly writable, but should deny users permission to arbitrarily delete or rename the files of others. 

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

BUGS

Since the text areas of sticky text executables are stashed in the swap area, abuse of the feature can cause a system to run out of swap. 

Neither open(2V) nor mkdir(2) will create a file with the sticky bit set. 

FILES

/tmp

SEE ALSO

chmod(1V), ld(1), chmod(2), chown(2), mkdir(2), open(2V)

Sun Release 4.0  —  Last change: 9 September 1987

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026