This article demonstrates how to get data out of Active Directory using Ldapsearch.
Install the tools:
yum install openldap*
A simple grab:
ldapsearch \ -x -h ad.server.local \ -D "myUserName" \ -W \ -b "dc=company,dc=local" \ -s sub "(cn=*)" cn mail sn
The above will get all users within LDAP hosted on the “ldap.server.local” server using the username “myUserName”. You’d be prompted for the password.
Next we grab all attributes of the account with a common name “James Brown”:
ldapsearch \ -x -h ad.server.local \ -D "myUserName" \ -W \ -b "dc=company,dc=local" "cn=James Brown"\ -s sub "(cn=*)" cn mail sn
The above will get all information out of LDAP with the common name (real name) “James Brown”.
you only need install openldap-clients package. yum -y install openldap-clients
I believe the “-h ” has been replaced by “-H ldap://”.