Breakdown
| Class | Digit | Symbolic | Read | Write | Execute |
|---|---|---|---|---|---|
| Owner (u) | 4 | r-- | ✔ | — | — |
| Group (g) | 6 | rw- | ✔ | ✔ | — |
| Others (o) | 0 | --- | — | — | — |
owner 4 = 4 · group 6 = 4 + 2 · others 0 = 0
Commands
chmod 460 file.txt
chmod u=r,g=rw,o= file.txt # same thing, symbolic
chmod -R 460 folder/ # recursive (careful: applies to files and directories)
find folder -type f -exec chmod 460 {} + # only files
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, cannot enter.
- Others (o): cannot list names, cannot create or delete entries, cannot enter.
Things to know
- The group can modify the file, so make sure the group contains only trusted users.
- The owner cannot write. To edit the file you must first add write permission (or use root).