Ubuntu Linux user groups

As a system administrator, you can create and manage groups for the user accounts on your Linux system. This way, you can assign administrative & configuration rights to Ubuntu users and files & folder access permissions to an entire group rather than a single user at a time. Sometimes you might need to know which user group a user belongs to in order to verify or perform group management operations or for assigning/de-assigning user rights. This article will describe the commands step-by-step that can be used to find out which group a user is a member of.

Open the Ubuntu Terminal through Ctrl+Alt+T or through the Dash or connect to the Ubuntu system by SSH.

Enter the following command in order to see which group the current user belongs to:

$ groups

This command lists all the groups that you belong to.

Enter the following command to check which group a particular user belongs to:

$ groups [username]

You can also use the following command to list the group members and their GIDs.

$ id [username]

Here is an example for the ‘guest’ user:

Groups the guest user belongs to

The gid output represents the primary group assigned to a user.

Enter the exit command in order to close the terminal window in case you do not want to work further.

Through this simple procedure, you can perform a simple check of a user account’s group information.

How to Check the User Group(s) an Ubuntu User Belongs To