It is very common to perform user inclusion to an existing group. This section guides you on how to add user into Linux Group.
Before starting to add user into a group, you must make sure that both group and users are available.
To add user into group, there are a number of ways: choose 1 of the following subsections.
You can manually edit the /etc/group
file by searching the group name and add the user from the list. Example, to add "user2" into "mygroup":
mygroup:x:1274:user1,user3
to
mygroup:x:1274:user1,user2,user3
Yo can also use usermod command to add all secondary groups at once using append argument:
$ usermod -a -G <all wanted groups> <user>
Following the example above, it is:
$ usermod -a -G mygroup,groupT,groupV user2
That's all for adding user into group.