chmod 4711
chmod 4711 is rws--x--x (with special bits).
What 4711 grants
| Who | Digit | Permissions | Adds up as |
|---|---|---|---|
| Owner | 7 | read, write, execute | 4 + 2 + 1 = 7 |
| Group | 1 | execute | 1 = 1 |
| Others | 1 | execute | 1 = 1 |
| Special | 4 | setuid | 4000 = 4 |
When 4711 is the right answer
Setuid with execute-only access for group and others. Occasionally used to let a program be run without its contents being readable, though the binary can still be copied by its owner.
The command
chmod 4711 filename
chmod -R 4711 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 | 4711 |
| Symbolic | rws--x--x |
As a file in ls -l | -rws--x--x |
As a directory in ls -l | drws--x--x |
| Binary | 111 001 001 |
| World-writable | No |
Frequently asked questions
What does chmod 4711 mean?
It sets owner to read, write, execute, group to execute, others to execute, with the setuid bit set. In symbolic notation that is rws--x--x.
How do I apply 4711?
Run chmod 4711 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 4711 safe?
Setuid means the program runs with its owner’s privileges regardless of who starts it. That is a deliberate privilege escalation and should exist only on binaries that were written to be safe under it.
What is 4711 in symbolic notation?
rws--x--x. Written as ls -l shows it, with a leading file-type character, an ordinary file would appear as -rws--x--x and a directory as drws--x--x.