hot to modify user group ubuntu
To modify an existing user, like adding that user to a new group, use the usermod
command.
Try this:
sudo usermod -a -G groupName userName
The user will need to log out and log back in to see their new group added.
- The
-a
(append) switch is essential. Otherwise, the user will be removed from any groups, not in the list. - The
-G
switch takes a (comma-separated) list of additional groups to assign the user to.