Categories: LinuxShellUbuntu

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

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 verify or perform group management operations or to assign/de-assigning user rights. This article will describe the commands step-by-step that can be used to determine which group a user is a member of.

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

Enter the following command 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:

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.

Vitux Staff

Recent Posts

How to Install Magento 2 on AlmaLinux

Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…

1 year ago

How to Install ISPConfig Hosting Control Panel with Apache Web Server on Ubuntu 24.04

ISPConfig is an open-source control panel that allows users to manage multiple servers from a…

1 year ago

How to Test your Email Server (SMTP) Using the Telnet Command

As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…

1 year ago

Managing Network Interfaces and Settings on Ubuntu 24.04 with nmcli

Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…

2 years ago

Using Restic Backup on Ubuntu 24.04

Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…

2 years ago

Installing phpMyAdmin on Rocky Linux 9 and Securing it with Let’s Encrypt SSL

phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…

2 years ago