Home » Linux Host, Ubuntu, SysAdmin » Linux Commands » How to Add User to Group in Linux ?

How to Add User to Group in Linux ?

By default, when you create a new user in Linux, it also creates a group with same name. i.e. the user is in group of itself when it is created.

As mentioned here “How to check Groups of User in Linux ?” you can check your users currently subscribed groups.

Now, situation comes where you need create a new group and add this your user to this newly created group OR add the user to already existing group. So, you can use the below command to add the user to group in Linux.

$ sudo usermod -aG "groupname" "username"

Using above command you can add your “username” to group “groupname”

For example,

$ sudo usermod -aG plugdev devlab

This command will add user “devlab” to group “plugdev”

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment