LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ldapsearch

queries LDAP directories

TLDR

Search for user
$ ldapsearch -x -H ldap://[server] -b "[dc=example,dc=com]" "(uid=[username])"
copy
Search with authentication
$ ldapsearch -x -D "[cn=admin,dc=example,dc=com]" -W -b "[dc=example,dc=com]" "(objectClass=*)"
copy
Return specific attributes
$ ldapsearch -x -b "[dc=example,dc=com]" "(uid=[user])" cn mail
copy
Search with TLS
$ ldapsearch -x -ZZ -H ldap://[server] -b "[base]" "[filter]"
copy
Output in LDIF format
$ ldapsearch -x -b "[base]" -LLL "(uid=[user])"
copy

SYNOPSIS

ldapsearch [options] [filter] [attrs...]

DESCRIPTION

ldapsearch queries LDAP directories. It connects to an LDAP server, performs searches based on filters, and returns matching entries.The tool is essential for directory administration, user lookup, and debugging LDAP configurations.

PARAMETERS

-x

Simple authentication.
-H uri
LDAP server URI.
-b dn
Search base DN.
-D dn
Bind DN.
-W
Prompt for password.
-w pass
Bind password.
-s scope
Search scope (base, one, sub).
-Z
Start TLS.
-ZZ
Require TLS.
-L
LDIF output format.
-LL
No comments in output.
-LLL
No comments or version.

INSTALL

sudo apt install ldap-utils
copy
sudo dnf install openldap-clients
copy
sudo apk add openldap-clients
copy

CAVEATS

Filter syntax must be correct. Base DN must match directory structure. Credentials needed for many operations. TLS recommended for security.

HISTORY

ldapsearch is part of OpenLDAP, which began in 1998 as an open source LDAP implementation. The LDAP protocol itself emerged from X.500 directory services in the early 1990s.

SEE ALSO

ldapadd(1), ldapmodify(1), slapd(8)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid