chmod +t
Sets the sticky bit: only a file's owner can delete or rename it in a shared directory.
In a directory everyone can write to, anyone can normally delete anyone else's files. The sticky bit stops that: a file can only be deleted or renamed by its owner, the directory's owner, or root.
It's why /tmp is mode 1777 — writable by all, but nobody can clean out your files.
What it changes
drwxrwxrwx (777)drwxrwxrwt (1777)the t replaces the others' x
Examples
chmod +t /srv/dropbox
add the sticky bit to a shared directory
chmod 1777 /srv/dropbox
the full /tmp-style mode in one go
ls -ld /tmp
see it in action: drwxrwxrwt
chmod -t /srv/dropbox
remove it
Good to know
- A lowercase
tmeans sticky plus execute for others; a capitalTmeans sticky without it, so others can't enter the directory at all. - Linux ignores the sticky bit on files. It only means something on directories.
- Sticky stops deletion and renaming, not writing: if a file itself is world-writable, others can still change its contents.
Frequently asked questions
What does chmod +t do?
It sets the sticky bit. On a directory, users can only delete or rename files they own, even if the directory is writable by everyone.
Why is /tmp drwxrwxrwt?
/tmp has mode 1777: every user can create files there, and the sticky bit (the final t) stops users from deleting each other's files.
What is the difference between t and T in ls -l?
Both mean the sticky bit is set. Lowercase t means others also have execute permission; capital T means they don't.