Breakdown
| Class | Digit | Symbolic | Read | Write | Execute |
|---|---|---|---|---|---|
| Owner (u) | 7 | rwx | ✔ | ✔ | ✔ |
| Group (g) | 6 | rw- | ✔ | ✔ | — |
| Others (o) | 1 | --x | — | — | ✔ |
owner 7 = 4 + 2 + 1 · group 6 = 4 + 2 · others 1 = 1
Commands
chmod 761 file.txt
chmod u=rwx,g=rw,o=x file.txt # same thing, symbolic
chmod -R 761 folder/ # recursive (careful: applies to files and directories)
find folder -type d -exec chmod 761 {} + # 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, cannot create or delete entries, cannot enter.
- Others (o): cannot list names, cannot create or delete entries, can enter (cd) and access files.
Things to know
- The group can modify the file, so make sure the group contains only trusted users.