Search code examples
linuxldapbindldap-queryselinux

Getting bind error while connecting to ldap


I have written the following ldap command to test ldap connection

 ldapsearch -x -h ldap.com -b "uid=user1,ou=people,dc=domain,dc=com" 

I am getting the following output

# extended LDIF
#
# LDAPv3
# base <uid=user1,ou=people,dc=domain,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# search result
search: 2
result: 1 Operations error
text: 000004DC: LdapErr: DSID-0C0907C2, comment: In order to perform this opera
 tion a successful bind must be completed on the connection., data 0, v2580

# numResponses: 1

Please suggest how to resolve bind error


Solution

  • The error implies you need to bind to the server to be able to perform the search. As an example:

    ldapsearch -D "cn=directory manager" -w secret -p 389 -h server.example.com -b "dc=example,dc=com" -s sub "(objectclass=*)"
    

    The man page for ldapsearch