Who can do what
| Class | Read (4) | Write (2) | Execute (1) | On a directory |
|---|---|---|---|---|
| Owner (u) | Yes | Yes | Yes | List the files. Enter it and open files inside. Create, rename and delete files. |
| Group (g) | Yes | Yes | Yes | List the files. Enter it and open files inside. Create, rename and delete files. |
| Others (o) | Yes | No | Yes | List the files. Enter it and open files inside. |
When to use chmod 775
Gives the owner and the group full access, and everyone else read and execute. A common mode for shared project directories where a team, through a shared group, edits the same files.
Safe when the group contains only the people who should edit. Pair it with the setgid bit (2775) on directories so new files inherit the group.
Commands
Set the mode with octal digits, or with the equivalent symbolic form:
chmod 775 path/to/file
chmod u=rwx,g=rwx,o=rx path/to/fileTo apply it to every directory below a folder (and not to the files), combine it with find:
find path/to/folder -type d -exec chmod 775 {} +chmod -R 775 changes files and directories alike, which is rarely what you want: directories usually need execute, regular files usually should not have it.