[CentOS] Shell script to list group members

Tue Sep 23 23:20:09 UTC 2008
Bob Beers <bob.beers at gmail.com>

On Tue, Sep 23, 2008 at 7:11 PM, Tim Alberts <talberts at msiscales.com> wrote:
> Barry Brimer wrote:
>>
>> With spaces separating groups:
>>
>> egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/
>> /g'
>>
>> With commas separating groups:
>>
>> egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }'
>
> I'm sorry, I didn't specify, I'm using LDAP for user/group management.
>  Ideally a command like 'groups' would be nice, except it would be the
> inverse, it would print the users in a group, not the groups a user belongs
> to.

I guess ...

ldapsearch ... "(group=xyz)" ...

HTH,
-Bob