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 # # LDAPv3 # base
with scope subtree # filter: uid=user1 # requesting: ALL # # user1, ehowstuff.local dn: uid=user1,dc=ehowstuff,dc=local uid: user1 givenName: user1 objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetorgperson sn: test cn: user1 test userPassword:: e1NTSEF9eTdNQTcyNUxnNjNPRXUxNUVkYk84TEJlTmp3M2d3Z3VoVEIreHc9PQ= = # search result search: 2 result: 0 Success # numResponses: 2 # numEntries: 1