Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Sticky Bit

Direct answer

The sticky bit (mode 1xxx, t in the others execute position) on a directory lets only a file's owner (or root) delete or rename it, even if others can write to the directory — as on /tmp.

When to use this

Use it for world- or group-writable directories where users must not delete each other's files.

First 30 seconds

1. ls -ld /tmp — drwxrwxrwt?

2. Missing → chmod 1777 /tmp.

3. Shared upload directories → chmod +t <dir>.

4. Test: another user cannot delete your file.

5. Check after restores or new mounts.

Operational verification

writable directory with sticky bit → delete or rename requested → kernel allows only the file owner, directory owner or root

Evidence · next step

For Permissions & Ownership → Sticky Bit, continue with the first unproven Topic check: Confirm the target is a directory with sticky bit set and record its owner/mode. If that boundary is healthy, advance to the adjacent check: Capture the acting process UID and target entry owner. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it for world- or group-writable directories where users must not delete each other's files.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

directory owner/mode + sticky bit → actor UID → target entry owner → unlink/rename request → DAC/special-bit decision → result

Healthy evidence: shared directory remains writable as intended while users cannot remove/rename entries they do not own outside allowed privilege cases.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Confirm the target is a directory with sticky bit set and record its owner/mode.

  • Capture the acting process UID and target entry owner.
  • Test unlink/rename separately from reading or modifying file content.
  • Check ACL/non-DAC policy if observed behavior differs from classic sticky semantics.

Verification chain. directory owner/mode + sticky bit → actor UID → target entry owner → unlink/rename request → DAC/special-bit decision → result

Step 3 Commands Verify boundary
chmod +t /srv/upload
ls -ld /tmp   # drwxrwxrwt
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: sticky is expected to prevent content writes/reads, or deletion failure is debugged only from file rw bits instead of directory semantics.

Step 5 Common mistakes Narrow the fault
  • Shared writable directories without sticky bit.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

/tmp and /var/tmp should be 1777. Without it, any user with write access to the directory can remove anyone's files.

Key checks
  • ls -l <path> — owner, group and mode
  • stat -c '%A %a %U:%G' <path> — symbolic and numeric mode with owner
  • namei -l <path> — permissions of every directory on the path
  • id <user> — user's groups
ReferenceWhat it is1 section · depth on demand

Core model

Evaluate sticky behavior together with directory write+execute permissions, entry ownership and directory ownership. The bit primarily affects unlink/rename authorization in directories; it does not make file contents private, immutable or unwritable when separate file permissions allow changes.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

Sticky Bit evidence explains directory entry deletion/rename restrictions, not content confidentiality, file write permission or broader application policy.

In depth

The sticky bit on shared directories

In a directory where everyone can write, anyone could normally delete or rename anyone else's files, because deleting needs write permission on the directory, not on the file. The sticky bit prevents that. The inode(7) manual page says that in a directory with the sticky bit, only three can rename or delete a file there:

  • the file's owner;
  • the directory's owner;
  • a privileged process.

Where it's used

DirectoryModePurpose
/tmp1777Everyone may create files; only owners may remove them
/var/tmp1777The same, preserved across reboots
/dev/shm1777Shared memory files
Shared drop folders1733 or 1770Users can drop files without deleting others'

Display

ls -lMeaning
drwxrwxrwtSticky and others execute set
drwxrwxrwTSticky set, but others have no execute: usually unintended

On files, the sticky bit has no effect on Linux.

Related kernel protections

The sysctls fs.protected_symlinks and fs.protected_hardlinks stop the classic symlink and hard-link attacks in sticky world-writable directories. They're enabled by default on modern distributions. fs.protected_regular and fs.protected_fifos extend the protection to opening files and FIFOs.

host$ ls -ld /tmp /var/tmp
drwxrwxrwt 18 root root 4096 Nov 28 10:40 /tmp
drwxrwxrwt  9 root root 4096 Nov 28 03:10 /var/tmp
host$ sudo mkdir /srv/drop && sudo chmod 1777 /srv/drop
host$ sudo -u alice touch /srv/drop/alice.txt
host$ sudo -u bob rm /srv/drop/alice.txt
rm: cannot remove '/srv/drop/alice.txt': Operation not permitted
host$ sudo chmod o-t /srv/drop && sudo -u bob rm /srv/drop/alice.txt && echo removed
removed
host$ sysctl fs.protected_symlinks fs.protected_hardlinks fs.protected_regular
host$ sudo find / -xdev -type d -perm -0002 ! -perm -1000 2>/dev/null

Finding risky directories

The last command lists world-writable directories without the sticky bit. In such a directory, any user can delete or replace anyone else's files. Outside special cases, those directories should be fixed with chmod +t, or the world-write permission should be removed.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

Sticky Bit is part of Permissions & Ownership → Sticky Bit. Sticky Bit on a writable directory restricts removal or rename of contained entries so users generally cannot delete or rename another user’s files merely because the directory is writable; the canonical shared-space example is /tmp.

Topic-specific state model. Sticky Bit on a writable directory restricts removal or rename of contained entries so users generally cannot delete or rename another user’s files merely because the directory is writable; the canonical shared-space example is /tmp.

Interpretation rule. - Sticky directory ≠ confidential directory.

  • Sticky bit ≠ file write protection.
  • Directory write+execute without sticky can permit deletion independent of file write bits.
  • Sticky enforcement concerns ownership of directory/entry and privilege context, not only the file mode itself.

Quick reference

The sticky bit on a directory lets only the file owner, directory owner or root delete/rename files — even if others have write permission on the directory. /tmp and /var/tmp use it (mode 1777).

ls -ld /tmp                     # drwxrwxrwt
chmod +t /srv/dropbox; chmod 1777 /srv/dropbox
find / -xdev -type d -perm -0002 ! -perm -1000 -ls   # world-writable without sticky

On regular files the sticky bit has no effect on modern Linux.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. Sticky Bit evidence explains directory entry deletion/rename restrictions, not content confidentiality, file write permission or broader application policy.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. Sticky Bit owns shared-directory unlink/rename restriction semantics. File content permissions and ACLs remain separate.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Permissions & Ownership → Sticky Bit. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.kernel.org/doc/man-pages/ · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
sticky bit linuxtmp sticky bitt permission linuxshared directory sticky
Embedded reference data

Quick lookup tables

Sticky Bit operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Sticky Bit.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateSticky Bit on a writable directory restricts removal or rename of contained entries so users generally cannot delete or rename another user’s files merely because the directory is writable; the canonical shared-space example is /tmp.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin the exact process/session → resolve user/group names to numeric UID/GID through the effective identity stack → capture effective UID/GID + supplementary groups → resolve every required path component and target inode → inspect numeric owner/group + mode + ACL/mask + special bits → capture sudo/privilege transition if present → account for non-DAC controls → repeat the original workload operation.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chaindirectory owner/mode + sticky bit → actor UID → target entry owner → unlink/rename request → DAC/special-bit decision → resultTrace requested/configured state through effective state to the observed workload result.
Failure boundarySticky Bit evidence explains directory entry deletion/rename restrictions, not content confidentiality, file write permission or broader application policy.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux identity and authorization evidence can establish this proof path: directory owner/mode + sticky bit → actor UID → target entry owner → unlink/rename request → DAC/special-bit decision → resultUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured identity source, process credential, filesystem object, DAC/ACL, privilege or workload scope. Sticky Bit evidence explains directory entry deletion/rename restrictions, not content confidentiality, file write permission or broader application policy.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: keep the same process/session, resolve numeric identity and groups, inspect each path component plus target ownership/mode/ACL/special bits, capture any privilege transition/non-DAC denial, then repeat the original operation before broadening permissions.Continue to the next unresolved boundary while preserving the original test condition.

Sticky Bit · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundarySticky Bit
Topic pathPermissions & Ownership → Sticky Bit
Runtime stateSticky Bit on a writable directory restricts removal or rename of contained entries so users generally cannot delete or rename another user’s files merely because the directory is writable; the canonical shared-space example is /tmp.
Fast checks- Confirm the target is a directory with sticky bit set and record its owner/mode. - Capture the acting process UID and target entry owner. - Test unlink/rename separately from reading or modifying file content. - Check ACL/non-DAC policy if observed behavior differs from classic sticky semantics.
Verification chaindirectory owner/mode + sticky bit → actor UID → target entry owner → unlink/rename request → DAC/special-bit decision → result Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundarySticky Bit evidence explains directory entry deletion/rename restrictions, not content confidentiality, file write permission or broader application policy. Boundary chain: process/socket namespace → source/rule/FIB → neighbor → netfilter/eBPF/qdisc → virtual/physical device → peer → return → application.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?