Score:1

Openldap user login fails when testing with ldapsearch

cl flag

Using this ldif file:

# LDIF Export for cn=sample,dc=example,dc=org
# Server: ldap-service (ldap-service)
# Search Scope: sub
# Search Filter: (objectClass=*)
# Total Entries: 3
#
# Generated by phpLDAPadmin (http://phpldapadmin.sourceforge.net) on February 8, 2018 7:38 pm
# Version: 1.2.3

version: 1

# Entry 1: cn=sample,dc=example,dc=org
dn: cn=sample,dc=example,dc=org
cn: sample
gidnumber: 500
objectclass: posixGroup
objectclass: top

# Entry 2: cn=John Doe,cn=sample,dc=example,dc=org
dn: cn=John Doe,cn=sample,dc=example,dc=org
cn: John Doe
gidnumber: 500
givenname: John
homedirectory: /home/users/jdoe
loginshell: /bin/sh
objectclass: inetOrgPerson
objectclass: posixAccount
objectclass: top
sn: Doe
uid: jdoe
uidnumber: 1000
userpassword: {MD5}X03MO1qnZdYdgyfeuILPmQ==

# Entry 3: cn=Sally Hudson,cn=sample,dc=example,dc=org
dn: cn=Sally Hudson,cn=sample,dc=example,dc=org
cn: Sally Hudson
gidnumber: 500
givenname: Sally
homedirectory: /home/users/shudson
loginshell: /bin/sh
objectclass: inetOrgPerson
objectclass: posixAccount
objectclass: top
sn: Hudson
uid: shudson
uidnumber: 1001
userpassword: {MD5}X03MO1qnZdYdgyfeuILPmQ==

I have populated an openldap server running on localhost on default port 389 and verified the connection/content:

enter image description here

Now I would like to test that the user: John Doe can login using ldapsearch. I have tried:

ldapsearch -x -h localhost -p 389 -x -D 'cn=sample,cn=John Doe,dc=example,dc=org' -w password
ldapsearch -x -h localhost -p 389 -x -D 'cn=John Doe,dc=example,dc=org' -w password
ldapsearch -x -h localhost -p 389 -x -D 'uid=jdoe,cn=sample,dc=example,dc=org' -w password

but they all fail with:

ldap_bind: Invalid credentials (49)

even after I have tried to update the password (using Apache Directory Studio).

Also tried updating with a plain text password: qwerty

enter image description here

$ ldapsearch -x -h localhost -p 389 -x -D 'uid=jdoe,cn=sample,dc=example,dc=org' -w 'qwerty'
ldap_bind: Invalid credentials (49)

Same error.

Any suggestions?

olivierg avatar
us flag
stupid question: do you have special characters in your password ? did you single quote it ?
cl flag
No there are no special characters and I also just tried with a simple plain text password. Still getting the same error. Do I need to create some root/administrative user and pass that to ldapsearch instead of the actual users themselves?
in flag
Have you tried with 'cn=John Doe,cn=sample,dc=example,dc=org'?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.