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.
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.
Why did labmember lose the lab-readers group after the request?
-
Groups know nothing about each other, and any combination is possible. The
-Goption decided it all. -
There is no two-group limit: student has two, and
usermod -aGeasily gives labmember three. -
The group is still there:
getent group lab-readersfinds it. Only labmember disappeared from it.
-G set labmember's full list of supplementary groups, and lab-readers was not on it.