Linux Labs

Users, permissions, and processes / Stage 3 of 13

Changing and diagnosing permissions

Not running Starting usually ~20 s
Leave the lesson

Step 2 of 8 · on a machine · 6 min

chmod: whom and what

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.

Exercise · do it

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.

Sign in and start The machine is available after signing in

Goals · 0 of 2

  • Let the owner run report.sh not done yet
  • Keep the script's text unchanged not done yet

Step goals

0 of 2
  • Let the owner run report.sh — not done yet
  • Keep the script's text unchanged — not done yet
Ubuntu 24.04

Step goals

0 of 2
  • Let the owner run report.sh — not done yet
  • Keep the script's text unchanged — not done yet
Loading…