Linux: Find Out The Groups A User Is In

by on July 7, 2009 · 0 comments· LAST UPDATED July 7, 2010

in

How do I find out group membership for each user? How do I find out which users are in a group called sales?

The groups command display the groups a user is in. In this example, find out the group membership for user vivek, enter:

 groups userName
 groups vivek

Sample outputs:

vivek : vivek adm dialout cdrom plugdev lpadmin netdev admin sambashare libvirtd

User vivek is member all of the above groups. Find out all users belongs to the group called adm:

grep -w groupName /etc/group
grep -w adm /etc/group

Sample outputs:

adm:x:4:vivek,top,jerry

See also:

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 0 comments… add one now }

Leave a Comment

Tagged as: , , , , , ,

Previous Faq:

Next Faq: