Simple LDAP query



I'm using ruby-1.8.6 and trying to query my Windows Active Directory
LDAP server. But I'm getting connection failed. I can ping the AD
server, I can resolve the host name or the IP address and I know the
LDAP authentication is working. But I'm still getting error message
when I query it via the following script. The error message I get is
"fail!"

Could anyone please tell me what I'm doing wrong? Do I need to define
the base DN?

#!/usr/bin/ruby
require 'rubygems'
require 'net/ldap'

ldap = Net::LDAP.new
ldap.host = "ldap.domain.com"
ldap.port = 389
ldap.auth "user_ID", "password"
if ldap.bind
print "success!\n"
# authentication succeeded
else
print "fail!\n"
# authentication failed
end

.



Relevant Pages

  • Re: LDAP Authentication from Linux
    ... I think you're right about the Query privileges. ... user marsh authentication failed; ... Depending how you have LDAP set up, remember that the user you configure must have privileges to query AD. ...
    (microsoft.public.windows.server.sbs)
  • Gnome - autofs nfs home directories
    ... Thanks to the help I got in this list my LDAP authentication now works ... get authenticated by the LDAP server and autofs ... Everything works fine providing a user doesn't log on to two machines at ...
    (Fedora)
  • Re: Sun Java System Directory Server Authentication
    ... Note that I'm not picking on you, I largely following your reasoning and that I don't agree ... The same goes for LDAP, at the core each LDAP server handles the LDAP protocol, but that ... Solaris LDAP to handle NTLM authentication. ... network "authentication" as used when binding against an LDAP server is meant to 1) validate ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: USE of ADFS
    ... For pure LDAP authentication, ... controller in the forest to authenticate a user in ANY domain in the forest. ... unless you specify that domains ldap server. ...
    (microsoft.public.windows.server.active_directory)
  • Re: AD Auth for standalone ISA in DMZ
    ... you can't use LDAP for access rules. ... until you change the authentication method of select a different user ... Under Specify RADIUS and LDAP Servers, ...
    (microsoft.public.isa.configuration)