When setting up a new Moodle install with LDAP authentication I was finding that my test users wen’t able to login with the normal Active Directory user name/password (sAMAccountName). After a little playing I found that they could login fine if they used what is known as the container name (cn).

After a little digging it turns out this is one of the big ‘gotchas’ about Moodle and LDAP in that the default Moodle LDAP setup goes for the cn user attribute as the username instead of the sAMAccountName user attribute as you would expect.

Simple solution is to go into the LDAP authentication on your Moodle install and put in samaccountname as you see above in the box ‘User attribute’.