LDAP User Enumeration

Extract all domain users and save to users.txt

Tool
ldapsearch
Category
Enumeration / LDAP
Platform
linux
Requires
password
Protocols
LDAP

Open in Command Manager

Syntax

Angle-bracket tokens are placeholders — replace them with your target's values, or open this command in the app to fill them in and copy the result.

ldapsearch -x -H ldap://<ip> -D '<user>@<domain>' -w '<password>' -b '<dc_dn>' '(objectClass=user)' sAMAccountName | grep 'sAMAccountName:' | cut -d: -f2 | tr -d ' ' | sort -u > users.txt

Examples

ldapsearch -x -H ldap://192.168.1.100 -D 'user@CORP.LOCAL' -w 'password' -b 'DC=CORP,DC=LOCAL' '(objectClass=user)' sAMAccountName

Tags

ldapsearch ldap users enumeration