Using ldapwhoami
Learn how to use the ldapwhoami command to retrieve current user details and connection information from an LDAP server - a vital tool for system administrators.
Date: 11-04-2022
The ldapwhoami command serves two purposes:
- Test authentication
- Confirm the identity of the user that binds
Syntax
`ldapwhoami <opts> [-D bindDN (-w|-W)]`We recommended you use simple binds (-x) and the -W (prompt for password) Option is used. The -w Option will retain the password used is stored in the shell's history
Examples
# Test if a password a user binding with is correct (successful result)
ldapwhoami -x -H ldap:/// -D "cn=May Gaul,ou=Accounting,dc=example,dc=com" -w secret
dn: cn=May Gaul,ou=Accounting,dc=example,dc=com# Test if a password a user is binding with is correct (unsuccessful result)
ldapwhoami -x -H ldap:/// -D "cn=May Gaul,ou=Accounting,dc=example,dc=com" -w secrot
ldap_bind: Invalid credentials (49)# See what identity the linux root user maps to with a SASL bind
ldapwhoami -Q -Y EXTERNAL
dn: dc=example,dc=comFor more information, please see ldapwhoami Man Page.