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