This post will show you the list of ldapsearch examples for 389 Directory. This ldapsearch examples assumes the following:
a)This ldapsearch is search for uid in the directory.
b)The 389 directory is configured to not support anonymous access, then the user “Directory Manager” and the password is required
c)This ldapsearch command has been run on the 389 server itself, so “localhost” for host is enough.
d)The server uses port number 389. Since this is the default port, the port number does not have to be sent in the search request.
-D binddn bind DN
-b basedn base dn for search
-h host LDAP server
-w passwd bind password (for simple authentication)
-W prompt for bind password (Recommended to use this to hide password)
ldapsearch -h localhost -D "cn=Directory Manager" -W -b dc=ehowstuff,dc=local uid=user1
[root@ldapmaster-11 ~]# ldapsearch -h localhost -D "cn=Directory Manager" -W -b dc=ehowstuff,dc=local uid=user1
Enter LDAP Password:
# extended LDIF
# base with scope subtree
# filter: uid=user1
# requesting: ALL
# user1, ehowstuff.local
cn: user1 test
# search result
result: 0 Success
# numResponses: 2
# numEntries: 1