chmod changes a file's permissions. In symbolic notation you tell it which triple gains or loses what.
The notation has three parts. Whom: u for the owner, g for the group, o for others, a for all three. What to do: + adds, - removes, = leaves exactly these letters. Which rights: r, w, x.
| Command | What it changes |
|---|---|
chmod g+w notes.txt |
the group gains write |
chmod o-r notes.txt |
others lose read |
chmod o= notes.txt |
others are left with nothing |
chmod u+x,g-w notes.txt |
two changes, separated by a comma |
The command leaves the rest of the permission string alone: g+w changes one letter in the group triple.
A file's permissions can be changed by its owner, and by root. On someone else's file chmod without sudo prints Operation not permitted.
Let the script run again
In /srv/permissions-lab, make ./report.sh run for you, its owner. The group and others get no new rights, and the script's text stays the same.
Goals · 0 of 2
- Let the owner run report.sh not done yet
- Keep the script's text unchanged not done yet