Friday, September 16, 2011

LDAP search queries

Some quick examples of common LDAP search queries. See this blog for more explanation and examples (thanks for the comment)

Search for a particular user:
ldapsearch -LLLx "uid=myuser"
If your LDAP database is giant, you might want to limit that search to just the people tree:
ldapsearch -LLLx -b ou=people,dc=myorg,dc=com "uid=myuser"
Find a netgroup:
ldapsearch -LLLx -b ou=netgroup,dc=myorg,dc=com ""
Wildcards also work:
ldapsearch -LLLx -b ou=netgroup,dc=myorg,dc=com "cn=*fred*"
Regular group:
ldapsearch -LLLx -b ou=group,dc=myorg,dc=com "cn=sysadmins"


Anonymous said...

For more information on ldapsearch, see Using ldapsearch.

G said...

Thanks, linked in the post.