Califer
Califer

Reputation: 528

I am unable to bind to an LDAP server due to "Invalid Credentials", though the credentials are valid

I'm setting up a php page to connect to an LDAP server but for some reason it will not let me connect. At first I thought that my credentials had not been set up correctly, but after entering them into Softerra LDAP browser I was able to connect there.

<?php 
    $url = "ldaps://ldap.XXX.XXXX.edu:PORT/o=XXXX.edu";
    $ldap_user = "uid=XXXXXXXX,ou=Campus Accounts,o=XXXX.edu";
    $ldap_pass = "XXXXXXXX";

    ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
    $conn = ldap_connect($url) or die ("Could not connect to server");
    if ($conn)
    {
        ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3) ;
        $bind = ldap_bind($conn, $ldap_user, $ldap_pass);
    }
?>

But all that I get back is the following message.

Warning: ldap_bind(): Unable to bind to server: Invalid credentials

Is there something extra I need to do to the user data to get it to be accepted?

Upvotes: 1

Views: 3394

Answers (1)

geoffc
geoffc

Reputation: 4100

If you are connecting to Active Directory (which is implied by the o=XXX.edu style notation (though if so, incorrect)) and by the comment suggestions of trying to bind as xxxx.edu\xxxx then the root most nodes in Active Directory are always dc= not o= and therefore a more correct bind DN or base DN would most likely finish as:

dc=xxx,dc=edu

Upvotes: 2

Related Questions