chmod 6755
chmod 6755 is rwsr-sr-x (with special bits).
What 6755 grants
| Who | Digit | Permissions | Adds up as |
|---|---|---|---|
| Owner | 7 | read, write, execute | 4 + 2 + 1 = 7 |
| Group | 5 | read, execute | 4 + 1 = 5 |
| Others | 5 | read, execute | 4 + 1 = 5 |
| Special | 6 | setuid, setgid | 4000 + 2000 = 6 |
When 6755 is the right answer
Both setuid and setgid on top of 755. Rare, and worth a second look wherever it appears, since it grants two separate privilege transitions at once.
The command
chmod 6755 filename
chmod -R 6755 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 | 6755 |
| Symbolic | rwsr-sr-x |
As a file in ls -l | -rwsr-sr-x |
As a directory in ls -l | drwsr-sr-x |
| Binary | 111 101 101 |
| World-writable | No |
Frequently asked questions
What does chmod 6755 mean?
It sets owner to read, write, execute, group to read, execute, others to read, execute, with the setuid and setgid bit set. In symbolic notation that is rwsr-sr-x.
How do I apply 6755?
Run chmod 6755 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 6755 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 6755 in symbolic notation?
rwsr-sr-x. Written as ls -l shows it, with a leading file-type character, an ordinary file would appear as -rwsr-sr-x and a directory as drwsr-sr-x.