[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: group name of a user



On 08/08/13 01:22 -0700, zeya badar wrote:
Hi
I am very new to openldap so i need some help on that
suppose i created one group and added users as a member
but when i am searching a user i am unable to find user's group name?
in which attribute we can find user's group name
can anyone help me to get group name of a user?

Assuming you have created a tree structure like:

dn: cn=group_name,ou=groups,dc=example,dc=com
...
cn: group_name
member: uid=user_name,ou=people,dc=example,dc=com

A search like this should return groups (cn's) that reference a user (dn):

ldapsearch <bind options> -b "ou=groups,dc=example,dc=com" \
  "member=uid=user_name,ou=people,dc=example,dc=com" cn | grep '^cn:'

Depending on how you have deployed your ldap infrastructure, i.e. you have
installed an nss ldap shim, you can find unix group membership with:

groups <user_name>

--
Dan White