Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to ldap. I need to specify username in plaintext with some parameter without any sasl.

So this command gonna give you some search results, but it always empty cause there's no authorization:

ldapsearch -h -p 389 -D "OU=SysAcc,OU=Infra,dc=mydomain,dc=com" -b "OU=blg,dc=whatever,dc=whatever2,dc=com"

I've found that I can add -w mypasswd to specify password, where can I specify a username? I started with ldapsearch because I'm having hard time to configure LDAP in one of web application I'm trying to setup. Just wanna check if my parameters are correct with ldapsearch tool, but I can't find how to specify username.


as from answer above just wanna write a final command how it should be:

   ldapsearch -h -p 389 -W -D "CN=sysMYUSER,OU=SysAcc,OU=Infra,dc=mydomain,dc=com" -b "OU=blg,dc=whatever,dc=whatever2,dc=com"
share|improve this question
up vote 4 down vote accepted

The -D option is the LDAP username-equivalent. It's the BindDN, which is the account you're trying to authenticate against with the password you supply either with -w or when prompted. You probably also want to use the -x option for a simple bind, since you're using a BindDN/password pair instead of SASL authentication.

share|improve this answer
I was completely confused about bind_dn purpose. I thought it's just a 'path' where my user lies, and base is a path where I should search for user I specify. bind_dn is a user itself, together with path. thanks. – holms Jun 26 '13 at 12:31
Yes, the BindDN is the "user". The BaseDN is the starting point for your search - it won't search anything that isn't below that point in the tree. – John Jun 26 '13 at 12:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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