Linux Labs

Users, permissions, and processes / Stage 3 of 13

Changing and diagnosing permissions

Not running Starting usually ~20 s
Leave the lesson

Step 5 of 8 · on a machine · 5 min

A file's owner and group

The group triple works for members of the file's group. If the file has the wrong group, that is what you change: permissions cannot fix it.

chown, from the same article, changes the owner and the group: sudo chown user:group file. Just the group: sudo chown :group file. Only root can give a file away, so chown usually runs through sudo. chown leaves the permissions alone, and chmod leaves the owner and group alone.

You test a colleague's write as the colleague. tee -a file appends the line it receives to the file, and through sudo -u it runs as the colleague:

bash
echo 'labpeer: ok' | sudo -u labpeer tee -a report.txt
Exercise · do it

Let a colleague into the report

Your colleague labpeer from the lab-editors group must read and append to /srv/permissions-lab/report.txt. The file's owner is student and stays so; others get no access, and the text must not be erased.

Sign in and start The machine is available after signing in

Goals · 0 of 3

  • Give the file to the lab-editors group, keeping student as owner not done yet
  • Give the group read and write, and others nothing not done yet
  • Keep the report's text not done yet

Step goals

0 of 3
  • Give the file to the lab-editors group, keeping student as owner — not done yet
  • Give the group read and write, and others nothing — not done yet
  • Keep the report's text — not done yet
Ubuntu 24.04

Step goals

0 of 3
  • Give the file to the lab-editors group, keeping student as owner — not done yet
  • Give the group read and write, and others nothing — not done yet
  • Keep the report's text — not done yet
Loading…