To add a group to the ones already assigned, you add the -a option to -G. The old list stays, and the new group goes on the end.
Without -a, the same command takes away every supplementary group that is not in the list. The mistake is silent: usermod prints nothing either way. That is why you look at id user before and after.
A group is granted for a task: a list copied from a colleague easily gives too much. sudo gives administrator rights, and adm gives reading of system logs: the nginx logs in /var/log/nginx belong to the adm group.
Add a group without losses
Add labmember to the lab-writers group. The lab-readers group and the primary group labmember must stay.
Goals · 0 of 2
- Add labmember to lab-writers not done yet
- Keep lab-readers and the primary group not done yet