This article covers how to add a user to a group on Ubuntu Linux System. If you want to learn about adding or removing a user on Linux OS, you can follow our guide on How to Add and Remove Users on Linux .
User accounts can be assigned to one or more groups on Linux. You can configure file permissions and other privileges by group. For example, on Ubuntu, only users in the sudo group can use the sudo command to gain elevated permissions.
To Add a New Group on Ubuntu Linux:
If you want to create a new group on your system, use the groupadd command following command, replacing new_group with the name of the group you want to create:
$ sudo groupadd mynewgroup
To Add an Existing User Account to a Group:
To add an existing user account to a group on your system, use the usermod command, replacing examplegroup with the name of the group you want to add the user to andexampleusername with the name of the user you want to add:
$ usermod -a -G examplegroup exampleusername