Hi , You would need to give the complete DN in -D option. So your search should be like :- ldapsearch -h remoteserver.com -p 389 -x -b "ou=admin,dc=state,dc=or,dc=us" -D "cn=remoteuser,cn=users,dc=state,dc=or,dc=us" -w remotepasswd cn=*
Make sure that "remoteuser" has the administrative privileges. If your LDAP server is Active directory you can use the DN ie -D as cn=administrator,cn=users,dc=state,dc=or,dc=us Regards, Deepthi -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Quanah Gibson-Mount Sent: Wednesday, August 12, 2009 11:33 PM To: [email protected]; [email protected] Subject: [ldap] Re: question about ldapsearch and authentication --On Wednesday, August 12, 2009 10:40 AM -0700 Christopher Adams <[email protected]> wrote: > > I am new to ldap syntax, so please bear with me. > > I am trying to harvest data from a remote ldap server. I have > credentials to do this, but it is not working for me. > > I can query it anonymously, but only get the default 1000 records. > > Here is what I have. I have substituted dummy host names, user, and > password. > > ldapsearch -h remoteserver.com -p 389 -x -b > "ou=admin,dc=state,dc=or,dc=us" -D "cn=remoteuser" -w remotepasswd > > When I do this, I get: ldap_bind: Invalid credentials > > If I don't use the password, and instead us -W, I get prompted for a > password, enter it and get the same result. > > I can do this using a GUI, so I know that the credentials work. > > Can someone give me some tips? Thanks. My guess is that the bindDN you are supposed to be using is what you put for your base. I.e., my guess is your ldapsearch should look like: ldapsearch -h remoteserver.com -p 389 -x -D "ou=admin,dc=state,dc=or,dc=us" -W cn=remoteuser (i.e., search for remoteuser, binding as the ou=admin DN). But maybe not. Maybe it is: ldapsearch -h remoteserver.com -p 389 -x -D "cn=remoteuser,ou=admin,dc=state,dc=or,dc=us" -W etc etc. The -D flag takes the *full dn* of the user you are wanting to bind with. --Quanah -- Quanah Gibson-Mount Principal Software Engineer Zimbra, Inc -------------------- Zimbra :: the leader in open source messaging and collaboration
