chmod 660
rw-rw----Safe when used as intended
Owner and group can read and write; others have no access.
660 lets the owner and the group read and write, and hides the file from everyone else. It suits files that two cooperating accounts — say, an app and its worker — both need to update, but that nobody else should see.
Permission by permission
| Who | Read | Write | Execute | Digit | Means |
|---|---|---|---|---|---|
| owner | ✓ | ✓ | — | 6 | read and write |
| group | ✓ | ✓ | — | 6 | read and write |
| others | — | — | — | 0 | no permissions |
- In
ls -l:-rw-rw----for a file,drw-rw----for a directory. - Symbolic form:
u=rw,g=rw,o= - New files get this mode when the umask is
006.
Use it for
- Shared data or state files between services in one group.
- Unix sockets meant for a specific group (database and app sockets often use it).
Avoid it for
- Files only one account uses:
600is tighter. - Files the group should only read:
640.
Commands
chmod 660 path
set this mode on a file or directory
chmod u=rw,g=rw,o= path
the same, written symbolically
find path -type f -exec chmod 660 {} +apply it to every file in a tree, leaving the directories alone
stat -c '%a %A %n' path
check the current mode on Linux (macOS: stat -f '%Lp %Sp %N' path)
Try variations
660
-rw-rw----
| Who | read | write | execute | Digit |
|---|---|---|---|---|
| owner | 6 | |||
| group | 6 | |||
| others | 0 |
The owner can read and write; the group can read and write; everyone else can do nothing.
chmod 660 file
chmod u=rw,g=rw,o= file
Frequently asked questions
660 vs 640?
660 lets the group write; 640 lets it only read. Grant group write only when the group really modifies the file.
Related modes