$linuxjunkies
>

sticky bit

also: restricted deletion flag

A special file permission bit that prevents users from deleting or renaming files they don't own, even if they have write permission to the directory. Commonly used on shared directories like /tmp to protect other users' files.

The sticky bit is a permission flag set on a directory using the fourth octal digit in chmod notation (e.g., chmod 1777 /tmp). When enabled, only the file owner, the directory owner, or root can delete or rename files within that directory, regardless of the directory's write permissions.

This is essential for shared temporary directories. For example, /tmp has write access for all users (mode 1777), allowing anyone to create files. However, the sticky bit prevents user Alice from deleting user Bob's file in /tmp, even though both have write permission to the directory itself.

In symbolic notation, you can set it with chmod +t filename or display it in long listings as a t at the end of permissions: drwxrwxrwt (or T if execute permission is missing on the directory).

Related terms