chmod 1777
rwxrwxrwtUse with care
777 plus the sticky bit: anyone can create, only owners can delete.
1777 is 777 with the sticky bit set on a directory. Anyone can create files in it, but a file can only be renamed or deleted by its owner, the directory's owner, or root. In ls -l the last x becomes a t: rwxrwxrwt.
It's the mode of /tmp and /var/tmp, and the correct mode for any world-writable shared directory.
Permission by permission
| Who | Read | Write | Execute | Digit | Means |
|---|---|---|---|---|---|
| owner | ✓ | ✓ | ✓ | 7 | read, write and execute |
| group | ✓ | ✓ | ✓ | 7 | read, write and execute |
| others | ✓ | ✓ | ✓ | 7 | read, write and execute |
- In
ls -l:-rwxrwxrwtfor a file,drwxrwxrwtfor a directory. - Symbolic form:
u=rwx,g=rwx,o=rwx,+t - New directories get this mode when the umask is
000.
Use it for
/tmp-style directories that every user writes to.- Shared drop folders where users must not delete each other's files.
Avoid it for
- Anywhere a narrower group would do: a group-owned
2775directory is easier to reason about. - Remember files created inside still get their creator's umask — the sticky bit only controls deletion.
Commands
chmod 1777 path
set this mode on a file or directory
chmod u=rwx,g=rwx,o=rwx,+t path
the same, written symbolically
find path -type d -exec chmod 1777 {} +apply it to every directory in a tree, leaving the files alone
stat -c '%a %A %n' path
check the current mode on Linux (macOS: stat -f '%Lp %Sp %N' path)
Try variations
| Who | read | write | execute | Digit |
|---|---|---|---|---|
| owner | 7 | |||
| group | 7 | |||
| others | 7 |
The owner can read, write and execute; the group can read, write and execute; everyone else can read, write and execute. Special: only owners can delete their own entries (sticky).
chmod 1777 file
chmod u=rwx,g=rwx,o=rwx,+t file
Frequently asked questions
What does the t in drwxrwxrwt mean?
The sticky bit. On a directory, it limits deleting and renaming entries to their owners. A capital T means sticky is set but others' execute isn't.
How do I fix /tmp permissions?
Run chmod 1777 /tmp as root. Many programs fail or refuse to start when /tmp isn't world-writable with the sticky bit.