How do I add a user to multiple groups in Ubuntu?
The utility is usermod
and is used like:
usermod -a -G group1,group2 username
Where username
is the user you want to modify and group1
and group2
are the new groups you want that user to join. Running the command without the -a
argument will remove that user from all groups except group1
and group2
.
To check a users group memberships use the groups
command:
groups username
usermod -a -G group1,group2,group3 username