Breakdown
| Class | Digit | Symbolic | Read | Write | Execute |
|---|---|---|---|---|---|
| Owner (u) | 6 | rw- | ✔ | ✔ | — |
| Group (g) | 5 | r-x | ✔ | — | ✔ |
| Others (o) | 6 | rw- | ✔ | ✔ | — |
owner 6 = 4 + 2 · group 5 = 4 + 1 · others 6 = 4 + 2
Commands
chmod 656 file.txt
chmod u=rw,g=rx,o=rw file.txt # same thing, symbolic
chmod -R 656 folder/ # recursive (careful: applies to files and directories)
find folder -type d -exec chmod 656 {} + # only directories
Applied to a directory
- Owner (u): can list names, cannot create or delete entries, cannot enter.
- Group (g): can list names, cannot create or delete entries, can enter (cd) and access files.
- Others (o): can list names, cannot create or delete entries, cannot enter.
Things to know
- Others can write. Any user on the system can modify or replace this file. Avoid world-writable modes outside of /tmp-style directories (which also use the sticky bit, 1777).