Skip to content
Calcrivo

Sticky Bit Calculator

Interpret the sticky bit (1000) restricting file deletion to owners, as used on /tmp.

Inputs

Sticky Bit Assessment

Sticky bit is SET on a world-writable directory (/tmp) — the safe, intended pattern. Any user can create files here, but only the file's owner (or root) can delete or rename it, preventing users from deleting each other's files.

Risk Level

Low

Sticky Bit Set?

true

World-Writable?

true

Step by step

  1. Values used

    Full Octal Mode (e.g. 1777) = 1,777; Directory Description (optional, e.g. /tmp) = /tmp

  2. Sticky bit in octal notation

    1000 = sticky bit; full mode = 1000 + owner/group/other permission bits (e.g. 1777)

  3. Sticky Bit Assessment

    = Sticky bit is SET on a world-writable directory (/tmp) — the safe, intended pattern. Any user can create files here, but only the file's owner (or root) can delete or rename it, preventing users from deleting each other's files.

  4. Risk Level

    = Low

  5. Sticky Bit Set?

    = Yes

  6. World-Writable?

    = Yes

How it works

The sticky bit, 1000 in octal special-permissions notation, restricts file deletion within a directory: even if a directory is world-writable (allowing any user to create files in it), only a file's owner or root can delete or rename that specific file when the sticky bit is set — without it, anyone with write access to the directory could delete or rename any file inside regardless of who created it. This is exactly why /tmp and /var/tmp ship with mode 1777 (world-writable plus sticky) by default: every user needs to be able to create temporary files there, but users must not be able to tamper with or delete each other's temp files.

Formula

Sticky bit in octal notation

1000 = sticky bit; full mode = 1000 + owner/group/other permission bits (e.g. 1777)

Frequently Asked Questions

How do I set the sticky bit on a directory?

`chmod +t /path/to/dir` sets it (equivalently `chmod 1777 /path/to/dir` for a fully world-writable directory with sticky protection); `chmod -t /path/to/dir` removes it. A sticky directory typically displays a trailing 't' (or 'T' if not executable/searchable) in `ls -ld` output.

How do I find all world-writable directories missing the sticky bit?

`find / -xdev -type d -perm -0002 ! -perm -1000 2>/dev/null` finds world-writable directories where the sticky bit is NOT set — a common security audit check, since such directories allow any user to delete or rename files owned by other users.

Does the sticky bit do anything on a regular file?

On modern Linux, setting the sticky bit on a regular (non-directory) file has no effect — historically on some older Unix systems it hinted to the kernel to keep the program's text segment in swap for faster reloading, but this legacy 'saved text' behavior is obsolete on Linux.

You might also need