chmod 2775
chmod 2775 is rwxrwsr-x (with special bits).
What 2775 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 | 5 | read, execute | 4 + 1 = 5 |
| Special | 2 | setgid | 2000 = 2 |
When 2775 is the right answer
775 plus setgid — the usual setting for a collaborative directory. Group members can write, and everything created inside stays in the shared group automatically.
The command
chmod 2775 filename
chmod -R 2775 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 | 2775 |
| Symbolic | rwxrwsr-x |
As a file in ls -l | -rwxrwsr-x |
As a directory in ls -l | drwxrwsr-x |
| Binary | 111 111 101 |
| World-writable | No |
Frequently asked questions
What does chmod 2775 mean?
It sets owner to read, write, execute, group to read, write, execute, others to read, execute, with the setgid bit set. In symbolic notation that is rwxrwsr-x.
How do I apply 2775?
Run chmod 2775 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 2775 safe?
It grants no write access outside the owner and the group, so it is a reasonable setting as long as the owner is the account you intend.
What is 2775 in symbolic notation?
rwxrwsr-x. Written as ls -l shows it, with a leading file-type character, an ordinary file would appear as -rwxrwsr-x and a directory as drwxrwsr-x.