LDAP query in python

While the accepted answer does in fact show a proper way to bind to an LDAP server I do feel it didn’t answer the question holistically. Here is what I ended up implementing to grab the mail and department of a user. This somewhat blends the required attributes from the original question. l = ldap.initialize(‘ldap://ldap.myserver.com:389’) … Read more

Query to list all users of a certain group

memberOf (in AD) is stored as a list of distinguishedNames. Your filter needs to be something like: (&(objectCategory=user)(memberOf=cn=MyCustomGroup,ou=ouOfGroup,dc=subdomain,dc=domain,dc=com)) If you don’t yet have the distinguished name, you can search for it with: (&(objectCategory=group)(cn=myCustomGroup)) and return the attribute distinguishedName. Case may matter.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)