Use it for world- or group-writable directories where users must not delete each other's files.
Sticky Bit
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.
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.
writable directory with sticky bit → delete or rename requested → kernel allows only the file owner, directory owner or root
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
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
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 · 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.
/tmp and /var/tmp should be 1777. Without it, any user with write access to the directory can remove anyone's files.
ls -l <path>— owner, group and modestat -c '%A %a %U:%G' <path>— symbolic and numeric mode with ownernamei -l <path>— permissions of every directory on the pathid <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
| Directory | Mode | Purpose |
|---|---|---|
/tmp | 1777 | Everyone may create files; only owners may remove them |
/var/tmp | 1777 | The same, preserved across reboots |
/dev/shm | 1777 | Shared memory files |
| Shared drop folders | 1733 or 1770 | Users can drop files without deleting others' |
Display
ls -l | Meaning |
|---|---|
drwxrwxrwt | Sticky and others execute set |
drwxrwxrwT | Sticky 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.
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.
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
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
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%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.
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.
Quick lookup tables
Sticky Bit operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Sticky Bit.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | 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. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin 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 chain | directory owner/mode + sticky bit → actor UID → target entry owner → unlink/rename request → DAC/special-bit decision → result | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Sticky 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 evidence | Correlated 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 → result | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It 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 check | Continue 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 boundary | Sticky Bit |
|---|---|
| Topic path | Permissions & Ownership → Sticky Bit |
| Runtime state | 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. |
| 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 chain | directory 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 boundary | Sticky 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 rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |