Breakdown
| Class | Digit | Symbolic | Read | Write | Execute |
|---|---|---|---|---|---|
| Owner (u) | 7 | rwx | ✔ | ✔ | ✔ |
| Group (g) | 7 | rwx | ✔ | ✔ | ✔ |
| Others (o) | 6 | rw- | ✔ | ✔ | — |
owner 7 = 4 + 2 + 1 · group 7 = 4 + 2 + 1 · others 6 = 4 + 2
Commands
chmod 776 file.txt
chmod u=rwx,g=rwx,o=rw file.txt # same thing, symbolic
chmod -R 776 folder/ # recursive (careful: applies to files and directories)
find folder -type d -exec chmod 776 {} + # only directories
Applied to a directory
- Owner (u): can list names, can create/delete entries, can enter (cd) and access files.
- Group (g): can list names, can create/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).