Breakdown
| Class | Digit | Symbolic | Read | Write | Execute |
|---|---|---|---|---|---|
| Owner (u) | 4 | r-- | ✔ | — | — |
| Group (g) | 4 | r-- | ✔ | — | — |
| Others (o) | 6 | rw- | ✔ | ✔ | — |
owner 4 = 4 · group 4 = 4 · others 6 = 4 + 2
Commands
chmod 446 file.txt
chmod u=r,g=r,o=rw file.txt # same thing, symbolic
chmod -R 446 folder/ # recursive (careful: applies to files and directories)
find folder -type f -exec chmod 446 {} + # 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): can list names, cannot create or delete entries, cannot enter.
Things to know
- Others can write. Any user on the system can modify or replace this file. Avoid world-writable modes outside of /tmp-style directories (which also use the sticky bit, 1777).
- The owner cannot write. To edit the file you must first add write permission (or use root).