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