I am integrating an iRedMail mail server with Active Directory (running on Windows 2012 R2) using this (official) guide, but when I try to perform a search in LDAP, I get an error message:

ldap_bind: Invalid DN syntax (34) additional info: invalid DN

I used this command:

ldapsearch -x -h win.basecamp.local -D 'vmail' -W -b 'cn=users,dc=basecamp,dc=local'

  • What version of CentOS? Please also provide the output of ldapsearch -VV. At worst, I would have expected ldap_bind: Invalid credentials (49) here. I can't immediately reproduce that error with only ldapsearch - at least not with the versions I readily have available. – ziesemer Oct 29 '16 at 21:00

The value passed to -D option is invalid. Man page has this explanation for -D option:

-D binddn
    Use the Distinguished Name binddn to bind to the LDAP directory.

You apparently used a username (vmail) while you should have used a distinguished name (similar to what you have in -b option) for password authentication.

I suspect (but CANNOT be sure) that distinguished name for your vmail user might be:


When I replaced the server domain name with its IP address, it have worked like a charm. So something went wrong with my DNS configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.