ldap

Login to ldap with uid instead of cn in DN input


I'm running into a problem using LDAP to authenticate logins.

I already created a user with all basic info and try to login through phpldapadmin with detail :

Login DN: cn=Sample User,ou=people,dc=example,dc=om
Password: xxxx

then it can login.

But when i try to use with this :

Login DN: uid=sampleuser,ou=people,dc=example,dc=om
Password: xxxx

it never works (cannot login).

Please tell me what should i config?


Solution

  • If the LDAP client is using a simple BIND operation, then the BIND DN must exist. The simple BIND operation takes as arguments at least the DN and a password.

    Consider the following entries:

    dn: cn=sample user,ou=people,dc=example,dc=com
    objectClass: top
    objectClass: inetOrgPerson
    cn: sample user
    uid: sampleuser
    

    is not the same entry as:

    dn: uid=sampleuser,ou=people,dc=example,dc=com
    objectClass: top
    objectClass: inetOrgPerson
    cn: sample user
    uid: sampleuser
    

    even though the attributes are identical (the SN which is required by inetOrgPerson is omitted in this example). Th DN is the primary key and must be used with the simple BIND operation. The entries given above, are two complete separate entries with two different DNs.