Quick Tip: How to search in Windows Active Directory from Linux with ldapsearch
Sometimes we need to query, under Linux, Active Directory for users/computers without accessing a remote desktop. We can achieve that with ldapserch. First you should install first ldap-utils. In Debian or Ubuntu just run:
$ sudo apt-get install ldap-utils
The syntax for using ldapsearch:
ldapsearch -x -LLL -h [host] -D [user] -w [password] -b [base DN] -s sub "([filter])" [attribute list]
A simple example
$ ldapsearch -x -LLL -h host.example.com -D user -w password -b"dc=ad,dc=example,dc=com" -s sub "(objectClass=user)" givenName





