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) | No | No | No | No access. |
When to use chmod 770
Gives the owner and the group full access and shuts everyone else out completely.
A good default for team directories that other users on the machine should not even list, such as an application's data directory shared by a service group.
Commands
Set the mode with octal digits, or with the equivalent symbolic form:
chmod 770 path/to/file
chmod u=rwx,g=rwx,o= 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 770 {} +chmod -R 770 changes files and directories alike, which is rarely what you want: directories usually need execute, regular files usually should not have it.