Linux Commands

How to Add a User to the Group in Linux

Linux is a multi-user operating system where individual permissions can be specified for each user. However, this can be problematic if there are several users and all are having the same rights and privileges. Because multiple users can connect and work at the same time and they should have the privileges as per their knowledge and experience. So, user management is one of the most important responsibilities of a system administrator which encompasses everything from creating, updating, and deleting user accounts and user groups.

How to add users to the group using the terminal in Linux

Let’s start with creating a new user first so that we can add them into the group by following the general syntax shown below.

$ sudo adduser user-name

For example:

$ sudo adduser linuxhint

Now let’s create a new group using the general syntax shown below.

$ sudo groupadd group-name

For example:

$ sudo groupadd linuxhintgroup

Now the general syntax to add any user to the group is:

$ sudo usermod -a -G group-name user-name

To add the user ‘linuxhint’ in the group ‘linuxhintgroup’, use the below mentioned command:

$ sudo usermod -a -G linuxhintgroup linuxhint

Here ‘-a’ option represents the addition process whereas ‘-G’ option represents the group option and ‘usermod’ shows that we are dealing with a user to add in the specific group, and at the end we have written the group name first and then the username.

Now if you like to verify that if a user is added to the group or not then you can do that by following the general syntax mentioned below.

$ grep user_name /etc/group

For example:

$ grep linuxhint /etc/group

In the above command ‘grep’ is used to find the specific keyword from any file like in our case we have mentioned the keyword ‘linuxhintgroup’ along with a filename ‘/etc/group’ from where it will find that keyword. By any chance, if you want to access this file then you can do that by typing:

$ nano /etc/group

You can also verify if the user has been added to a group or not by installing a third-party application with the name of “members” by typing:

$ sudo apt install members

After the installation, the general syntax that can be used to find the members in any group is:

$ members group_name

For example:

$ members linuxhintgroup

As you can see, the above commands show only one user which is ‘linuxhint’.

There is one other way to find the users in any group and you can do that by following the general syntax shown below.

$ groups user_name

For example:

$ groups linuxhint

The above command will search all the available groups and then it will show you that specific group where “linuxhint” is available.

How to add users to the group using GUI in Linux

We are currently using Linux mint where you can also add the user to the group by selecting the ‘Users and Groups’ option that you can find in the settings of your Linux distribution as shown below.

After that, you need to provide the password for authentication and later a new dialogue box will open where you need to select the ‘Groups’ tab and then add any group that you like by clicking on the ‘Add’ button as shown below.

After creating a new group, the next step is to assign a user to this group, and you can do that by selecting the ‘Users’ tab and the new user with the name of ‘linuxhint’.

Now, all you need is to click on the group tab and select the specific group where you want to associate a user as shown below.


Linux is a multi-user operating system in which each user can have their own set of permissions. This is a necessary step because user privileges should be based on their knowledge and expertise otherwise it can be problematic. In this article, we have explained two different ways to add users in the group that can either be using a terminal or it can also be done using a GUI.

About the author

Taimoor Mohsin