Linux Labs

Users, permissions, and processes / Stage 7 of 13

Managing group membership

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 6 · on a machine · 5 min

A group request

What you will learn

  • Tell the primary group from supplementary groups when changing an account.
  • Use usermod -aG, and replace the supplementary list only on purpose.
  • Check granted and revoked access in a fresh process of the user.

Your colleague labmember reads reports through the lab-readers group. Now he also needs the authors' drafts, the lab-writers group. The request comes with a ready command: sudo usermod -G lab-writers labmember.

Carry out the request and look at labmember's groups before and after.

Exercise · look

Carry out the group request

Look at labmember's groups, run the command from the request, and look at the groups again.

First, predict

What will id -nG labmember print after sudo usermod -G lab-writers labmember?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

Why did labmember lose the lab-readers group after the request?

  • Groups know nothing about each other, and any combination is possible. The -G option decided it all.

  • There is no two-group limit: student has two, and usermod -aG easily gives labmember three.

  • The group is still there: getent group lab-readers finds it. Only labmember disappeared from it.

-G set labmember's full list of supplementary groups, and lab-readers was not on it.

Ubuntu 24.04
Loading…