如何在ldap中获取用户组 [英] how to get groups of a user in ldap

查看:1510
本文介绍了如何在ldap中获取用户组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将openldap与phpldapadmin一起使用,并且我正在尝试检查某个用户的组. 这是我的计划...

i am using openldap with phpldapadmin, and i'm trying to check what are the groups of a certain user. this is my scheme ...

这是我尝试过的方法,但是没有用

this is what i tried, but it didn't work

docker-compose exec openldap ldapsearch -x -H "ldap://openldap" -D "cn=admin,dc=openldap" -w admin -b "cn=root,ou=django,dc=openldap" '(&(objectClass=*)(member=cn=superuser,ou=groups,dc=openldap))'

PS:我是ldap的新手,是我正在使用的图像

PS: i'm new to ldap, this is the image i'm using

推荐答案

关于LDAP和查询的文献很多,其中举例说明了如何搜索组.

There are tons of literature on LDAP and queries, that explain how to search for groups, with examples.

首先,baseDN(-b)应该位于层次结构的顶部:dc=openldap.

First the baseDN (-b) should be the top of your hierarchy: dc=openldap.

第二,您正在从组中搜索,因此过滤器应包含(objectclass=groupOfNames)

Second, you're searching from groups, so the filter should include (objectclass=groupOfNames)

最后,您正在搜索用户所属的组,并且过滤器应为(member=cn=root,ou=django,dc=openldap)

Finally, you're searching for the groups a user is member of, and the filter should be (member=cn=root,ou=django,dc=openldap)

然后得到的查询是:

ldapsearch -x -H "ldap://openldap" -D "cn=admin,dc=openldap" -w admin -b "dc=openldap" '(&(objectClass=groupOfNames)(member=cn=root,ou=django,dc=openldap))'

这将返回组条目.如果只对名称感兴趣,请在查询末尾添加  dn.

This will return the group entries. If you are only interested in the name, add   dn at the end of the query.

这篇关于如何在ldap中获取用户组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆