Skip to content

Ldap

Basic Queries

Basic anonymous query

 ldapsearch -H ldap://127.0.0.1:1389 -x -LLL -s base -b "dc=example,dc=org
import ldap

client = ldap.initialize("ldap://127.0.0.1:1389")
status = client.simple_bind()
query_result = client.search_s("dc=example,dc=org", ldap.SCOPE_SUBTREE)

Basic authenticated query

ldapsearch -H ldap://127.0.0.1:1389 -x -LLL -s base -D "cn=admin,dc=example,dc=org" -w pw -b "ou=users,dc=example,dc=org" -v
import ldap

client = ldap.initialize("ldap://127.0.0.1:1389")
status = client.simple_bind("admin", "pw")
query_result = client.search_s("dc=example,dc=org", ldap.SCOPE_SUBTREE)

Basic authenticated query interactive password

ldapsearch -H ldap://127.0.0.1:1389 -x -LLL -s base -D "cn=admin,dc=example,dc=org" -W

References & Resources

Libraries