views:

1773

answers:

3

In unix/linux how to you find out what group a given user is in via command line?

+11  A: 
groups

or

groups user
Bombe
+10  A: 

This one shows all the groups they belong to

id userid
Paul Tomblin
This appears to be pretty useful as well. It has more verbose output than the 'groups' command, so if you need the group id/user id use this!
Alex Argo
didn't know this one
benlumley
A: 

or just study /etc/groups (ok this does probably not work if it uses pam with ldap)

Nils
Indeed, that's a bad answer. 'getent group' is a better one.
bortzmeyer