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