Master-Zone Blog Technical Notes

9Oct/090

Searching Active Directory with ldapsearch

Okay, so I decided to carry on through journey of integrating AD with Linux. When I got AD working after my last post, I added a user for the testing purposes. And I needed to start browsing AD from Linux, so I installed ldapscripts package which provides ldapsearch utility for searching into LDAP (in the end Active Directory is an LDAP-like directory service).

# apt-get install ldapscripts

And here’s the magic syntax,

# ldapsearch -x -LLL -E pr=200/noprompt -D "cn=Administrator,cn=Users,dc=win2k3,dc=example,dc=com" -W -H ldap://win2k3.example.com:389 -b "cn=users,dc=win2k3,dc=example,dc=com" -s sub "(cn=*)" cn mail sn

And the result was

dn: CN=Users,DC=win2k3,DC=example,DC=com
cn: Users

dn: CN=Administrator,CN=Users,DC=win2k3,DC=example,DC=com
cn: Administrator

dn: CN=Guest,CN=Users,DC=win2k3,DC=example,DC=com
cn: Guest

output omitted

dn: CN=Ahmed O. Anwar,CN=Users,DC=win2k3,DC=example,DC=com
cn: Ahmed O. Anwar
sn: Anwar
mail: ahmed@example.com

# pagedresultscookie=

VN:F [1.7.5_995]
Rating: 0.0/10 (0 votes cast)

About Ahmed

UNIX Systems Administrator, obsessed with anything related to servers.
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


Trackbacks are disabled.