I am creating an LDAP directory and searching by the full DN shows the proper results.

$ ldapsearch -x -D "cn=ldapbind,dc=server,dc=com" -w bind

I want / need to be able to search using the email address as in:

$ ldapsearch -x -D [email protected] -w bind
ldap_bind: Invalid DN syntax (34)
    additional info: invalid DN

We have an Active Directory that allows ldapsearch to do that kind of search but I don't know what configuration changes do I need in order to have that in LDAP.

I am not attaching my slapd.conf because I want someone to show me the right configuration to do this, and mine is quite minimal.


2 Answers 2


Email field for bind DN works in version ldapsearch 2.4.23

  • The problem is not that ldapsearch doesn't have the ability to search a DN with email field, the problem is that when I query my current LDAP configuration it says 'Invalid DN'. Meaning the problem is with my LDAP configuration. So I want to know how to configure my LDAP to allow that.
    – DavidGamba
    Commented Aug 29, 2013 at 19:52
  • please rephrase your question properly.
    – Ura
    Commented Aug 29, 2013 at 19:55
  • edit: made it clear that I have an AD that allows my ldapsearch client to query using email. But it fails when querying the local LDAP.
    – DavidGamba
    Commented Aug 29, 2013 at 20:00

first you may forget to put the double quotes

ldapsearch -x -D "[email protected]" -w bind

if that doesn't work, maybe You have no schema defined.

In fact, you should probably just add core.schema to your slapd:

ldapadd -Q -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/core.ldif

Depending on what you're doing you'll probably also want:

- cosine
- inetorgperson
- nis 




You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .