How to connect to AWS simple AD using ldapsearch?

Viewed 1620

I've created a simple AD on AWS and I'm trying to connect to it using the Administrator credentials set up while creating the simple AD. I'm running the ldapsearch command from another EC2 instance in the same subnet. However I"m running into an authentication error and I'm pretty sure it's not the password, as I've tried changing it multiple time with no luck.

Below is the ldapsearch command I'm using.

$ldapsearch -x -v -h "10.*.*.112" -b "dc=corp-testing,dc=example,dc=com" –D "Administrator@corp-testing.example.com"  -W sAMAccountName=Administrator

Below is the output:

ldap_initialize( ldap://10.*.*.112 )
Enter LDAP Password:
ldap_bind: Invalid credentials (49)
additional info: 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1

Would someone be able to point out the issue on this?

3 Answers

I ran into the same issue and I have found the solution, the username needs to be prefixed with the Directory NetBIOS name (this is available from the Directory details page), then login with:

ldapsearch -x \
    -h 10.*.*.112 \
    -b "cn=Users,dc=corp-testing,dc=example,dc=com" \
    –D "${NetBIOSNAME}\\Administrator" \
    -W sAMAccountName=Administrator

Obviously, change ${NetBIOSNAME} to the appropriate value.

Okay I figured it out, however I don't know the WHY. Try changing your search to:

ldapsearch -x -v -H "ldap://10.*.*.112:389/" -b "dc=corp-testing,dc=example,dc=com" –D "cn=Administrator,dc=corp-testing,dc=example,dc=com" -W sAMAccountName=Administrator

I tried this several times without the trailing / on the URI but it didn't work.

Problem was that the Administrator is inside of the Users node, so -D should include cn=Users also:

ldapsearch -x -v -h "10.*.*.112" -b "dc=corp-testing,dc=example,dc=com" –D "cn=Administrator,cn=Users,dc=corp-testing,dc=example,dc=com" -W sAMAccountName=Administrator

Related