How to Find Out Which Groups a User Belongs to in Linux

In Linux, user permissions and security access are heavily managed through “groups.” For example, if you want a specific user to have the ability to execute administrator commands via sudo, or access a restricted shared folder, they must be added to the correct group. If a user is complaining that they get a “Permission denied” error when trying to run a script, the very first troubleshooting step is to check which groups they actually belong to.

Using the ‘groups’ Command

The fastest way to check group membership is by using the built-in groups command.

  1. Open your Linux terminal.
  2. To check your own current user groups, simply type:
    groups
  3. Press Enter.

The terminal will print out a space-separated list of all your assigned groups (e.g., john sudo docker www-data).

Checking Another User’s Groups

If you are an administrator and need to verify the permissions of a different user on the server (for example, a new employee named “sarah”), you can append their username directly to the end of the command.

groups sarah

This will instantly output something like sarah : sarah developers hr, confirming exactly which group permissions she has currently been granted. This command is completely safe and does not require sudo privileges to run.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.

Receive our best articles and tips delivered straight to your inbox.