- - - By CrazyStat - - -

18. January 2014

Linux: get members of a group / get groups of a user

Filed under: Linux,Server Administration — Tags: , , , , — Christopher Kramer @ 00:23

This might sound easy with /etc/group and /etc/passwd, but what if you use libnss-mysql for example and need to try if it works?

So just forget grepping config files. Here are the real commands:

Members of a group:

getent group GROUPNAME

Replace GROUPNAME with the group you want to check.

Groups of a user:


Replace USERNAME with the name of the user to check.


Checked on Debian, not sure if it works on any Linux/Unix.


Try my Open Source PHP visitor analytics script CrazyStat.

1 Comment »

  1. Thanks! Yes, it works on Redhat as well.

    Comment by CP — 17. December 2014 @ 13:46

RSS feed for comments on this post. TrackBack URL

Leave a comment