Using curl for querying Active Directory / LDAP from command line

2012-05-18

For quering Active Directory /LDAP from command line, you can run something like

curl -u DOMAIN\\\\MYACCOUNT:MYPASSWORD   \\
 "ldap://dc.redaelli.org:3268/OU=users,DC=redaelli,DC=org?memberOf,sAMAccountName?sub?(sAMAccountName=matteo)"

Comments:

Saqib Ali - Dec 1, 2018

Super thanks for posting this!


Enter your instance's address


More posts like this

Active Directory authentication for PostgreSQL users

2020-10-12 | #active directory #ldap #postgres

It is easy, you just need to add to the configuration file /var/lib/postgresql/data/pg_hba.conf host all all 0.0.0.0/0 ldap ldapserver="myldapserver" ldapbasedn="OU=USERS,DC=group,DC=redaelli,DC=org" ldapbinddn="CN=matteo,OU=USERS,DC=group,DC=redaelli,DC=org" ldapbindpasswd="MySillyPwd" ldapsearchattribute="sAMAccountName" ldapscheme="ldaps" And inside your database yu need to create a role for the Active director users and then grant them to the required databases.

Continue reading 