Breakdown
| Class | Digit | Symbolic | Read | Write | Execute |
|---|---|---|---|---|---|
| Owner (u) | 5 | r-x | ✔ | — | ✔ |
| Group (g) | 1 | --x | — | — | ✔ |
| Others (o) | 7 | rwx | ✔ | ✔ | ✔ |
owner 5 = 4 + 1 · group 1 = 1 · others 7 = 4 + 2 + 1
Commands
chmod 517 file.txt
chmod u=rx,g=x,o=rwx file.txt # same thing, symbolic
chmod -R 517 folder/ # recursive (careful: applies to files and directories)
find folder -type d -exec chmod 517 {} + # 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, can enter (cd) and access files.
- Others (o): can list names, can create/delete entries, can enter (cd) and access files.
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).