Search code examples
rubyldapopenldapldap-query

Insufficient access rights in ldap


I get insufficient access rights when trying to bind to an LDAP server using existing user_dn and userPassword even if the userPassword is incorrect. And I get invalid credentials if I put incorrect user_dn.

Why am I getting those errors? and what is the meaning of those errors? How should I fix them?

This is the code I used for binding

require 'net/ldap'
con = Net::LDAP.new
con.host = 'localhost'
con.port = 389
con.auth 'cn=user,dc=example,dc=com', 'user'

if con.bind
  # authentication succeeded
  puts 'success'
  puts con.get_operation_result
else
  # authentication failed
  puts 'fail'
  puts con.get_operation_result
 # p con.get_operation_result
end

Thanks in advance


Solution

  • Insufficient Access Rights means that the LDAP server has been configured to restrict who can access what. It's not a Bind (Authentication) error. You might want to check with the LDAP server administrator for the details.