chmod 1777
chmod 1777 is rwxrwxrwt (with special bits).
What 1777 grants
| Who | Digit | Permissions | Adds up as |
|---|---|---|---|
| Owner | 7 | read, write, execute | 4 + 2 + 1 = 7 |
| Group | 7 | read, write, execute | 4 + 2 + 1 = 7 |
| Others | 7 | read, write, execute | 4 + 2 + 1 = 7 |
| Special | 1 | sticky | 1000 = 1 |
When 1777 is the right answer
World-writable with the sticky bit, which is exactly what /tmp uses. Anyone may create files, but only a file’s owner may delete it — without the sticky bit any user could remove another user’s temporary files.
The command
chmod 1777 filename
chmod -R 1777 directory/
Because the owner has the execute bit, this works on a directory as well as a file — on a directory, execute is what grants the right to enter it and reach the entries inside.
How it is written elsewhere
| Octal | 1777 |
| Symbolic | rwxrwxrwt |
As a file in ls -l | -rwxrwxrwt |
As a directory in ls -l | drwxrwxrwt |
| Binary | 111 111 111 |
| World-writable | Yes — any user on the system can modify this |
Frequently asked questions
What does chmod 1777 mean?
It sets owner to read, write, execute, group to read, write, execute, others to read, write, execute, with the sticky bit set. In symbolic notation that is rwxrwxrwt.
How do I apply 1777?
Run chmod 1777 filename. Add -R to apply it to a directory and everything inside, though be careful: a recursive numeric chmod marks every file the same way, which is rarely correct for a mixed tree of files and directories.
Is 1777 safe?
It is world-writable, so any account on the system can modify the contents. That is only appropriate for a shared scratch area, which is why /tmp uses it together with the sticky bit. For anything else, grant access through a group instead.
What is 1777 in symbolic notation?
rwxrwxrwt. Written as ls -l shows it, with a leading file-type character, an ordinary file would appear as -rwxrwxrwt and a directory as drwxrwxrwt.