LDAPCOMPARE(1)
π LDAPCOMPARE(1) π
okay bestie, so we're doing a General Commands Manual page today, and it's literally ldapcompare β the LDAP compare tool. sit down, grab a boba, we're gonna slay this π«Ά
β¨ NAME β¨
ldapcompare β the LDAP compare tool, periodt π
πΈ SYNOPSIS πΈ
ldapcompare [-V[V]] [-d debuglevel] [-n] [-v] [-z] [-M[M]] [-x]
[-D binddn] [-W] [-w passwd] [-y passwdfile] [-H ldapuri] [-P {2|3}]
[-e [!]ext[=extparam]] [-E [!]ext[=extparam]] [-o opt[=optparam]]
[-O security-properties] [-I] [-Q] [-N] [-U authcid] [-R realm]
[-X authzid] [-Y mech] [-Z[Z]] DN {attr:value | attr::b64value}
like yes it's a whole wall of brackets, breathe, we'll get through all of it π
π¦ DESCRIPTION π¦
so ldapcompare is a shell-accessible interface to the ldap_compare_ext(3) library call. that's the whole vibe.
here's the tea π: ldapcompare opens a connection to an LDAP server, binds, and performs a compare using the parameters you gave it. the DN should be a distinguished name in the directory. Attr should be a known attribute.
and now the part that gets people every single time, no cap β the colons:
- if the attr is followed by one colon, the assertion value should be provided as a string.
- if it's followed by two colons, you're providing the base64 encoding of the value.
the result code of the compare is provided as the exit code and, unless you ran it with -z, the program prints TRUE, FALSE, or UNDEFINED on standard output. iconic behavior honestly β¨
π OPTIONS π
-V[V]β Print version info. If you use-VV, only the version information is printed. (double V = version-only mode, iykyk π )-d debuglevelβ Set the LDAP debugging level to debuglevel. heads up bestie:ldapcomparemust be compiled withLDAP_DEBUGdefined for this option to have any effect. so if it does nothing, that's why π-nβ Show what would be done, but don't actually perform the compare. super useful for debugging when you pair it with-v. the "window shopping" of flags essentially π-vβ Run in verbose mode, with many diagnostics written to standard output. it WILL yap. that's the point π-zβ Run in quiet mode, no output is written. You must check the return status. Useful in shell scripts. (silent but deadly, main character energy fr fr)-M[M]β Enable manage DSA IT control.-MMmakes control critical.-xβ Use simple authentication instead of SASL.-D binddnβ Use the Distinguished Name binddn to bind to the LDAP directory. For SASL binds, the server is expected to ignore this value.-Wβ Prompt for simple authentication. This is used instead of specifying the password on the command line. much safer vibe, we love to see it π«Ά-w passwdβ Use passwd as the password for simple authentication.-y passwdfileβ Use complete contents of passwdfile as the password for simple authentication. now READ THIS PART CAREFULLY because it's the #1 gotcha π¨: note that complete means that any leading or trailing whitespaces, including newlines, will be considered part of the password and, unlike other software, they will not be stripped. as a consequence, passwords stored in files by commands likeecho(1)will not behave as expected, sinceecho(1)by default appends a trailing newline to the echoed string. the recommended portable way to store a cleartext password in a file for use with this option is to useslappasswd(8)with{CLEARTEXT}as hash and the option-n. yeah. sneaky newline. we've all been there π-H ldapuriβ Specify URI(s) referring to the ldap server(s); only the protocol/host/port fields are allowed; a list of URI, separated by whitespace or commas is expected.-P {2|3}β Specify the LDAP protocol version to use.-e [!]ext[=extparam]-E [!]ext[=extparam]
Specify general extensions with -e and compare extensions with -E. Β΄!Β΄ indicates criticality.
General extensions:
[!]assert=<filter>β (an RFC 4515 Filter)!authzid=<authzid>β ("dn:<dn>"or"u:<user>")[!]bauthzidβ (RFC 3829 authzid control)[!]chaining[=<resolve>[/<cont>]][!]manageDSAit[!]noopppolicy[!]postread[=<attrs>]β (a comma-separated attribute list)[!]preread[=<attrs>]β (a comma-separated attribute list)[!]relaxsessiontracking[=<username>]abandon,cancel,ignoreβ (SIGINT sends abandon/cancel, or ignores response; if critical, doesn't wait for SIGINT. not really controls)
Compare extensions:
!dontUseCopy
-o opt[=optparam]β Specify anyldap.conf(5)option or one of the following:nettimeout=<timeout>β (in seconds, or"none"or"max")ldif_wrap=<width>β (in columns, or"no"for no wrapping)
-O security-propertiesβ Specify SASL security properties.-Iβ Enable SASL Interactive mode. Always prompt. Default is to prompt only as needed.-Qβ Enable SASL Quiet mode. Never prompt. π€«-Nβ Do not use reverse DNS to canonicalize SASL host name.-U authcidβ Specify the authentication ID for SASL bind. The form of the ID depends on the actual SASL mechanism used.-R realmβ Specify the realm of authentication ID for SASL bind. The form of the realm depends on the actual SASL mechanism used.-X authzidβ Specify the requested authorization ID for SASL bind. authzid must be one of the following formats:dn:<distinguished name>oru:<username>-Y mechβ Specify the SASL mechanism to be used for authentication. If it's not specified, the program will choose the best mechanism the server knows. it picks for you, king behavior π-Z[Z]β Issue StartTLS (Transport Layer Security) extended operation. If you use-ZZ, the command will require the operation to be successful. (double Z = no take-backsies π₯)
π EXAMPLES π
ldapcompare "uid=babs,dc=example,dc=com" sn:Jensen
ldapcompare "uid=babs,dc=example,dc=com" sn::SmVuc2Vu
are all equivalent. yes bestie, one colon string version and two colon base64 version, same energy, same result β¨
π LIMITATIONS π
Requiring the value be passed on the command line is limiting and introduces some security concerns. The command should support a mechanism to specify the location (file name or URL) to read the value from.
so yeah, that's a known thing, not me hating. it says it right there in the manual. no cap π«
π SEE ALSO π
π AUTHOR π
The OpenLDAP Project <http://www.openldap.org/>
π§ ACKNOWLEDGEMENTS π§
OpenLDAP Software is developed and maintained by The OpenLDAP Project <http://www.openldap.org/>. OpenLDAP Software is derived from the University of Michigan LDAP 3.3 Release.
okay that's the whole page, you ate it, go compare some attributes π β¨
this masterpiece of an LDAP situation is OpenLDAP 2.7.2, dated 2026/10/21, and it's literally the LDAPCOMPARE(1) moment. slay, bye π¦ππ
π¦ where this page comes from
- arch rolling: openldap 2.7.2-2 Β· OLDAP-2.8
- Copyright 1998-2026 The OpenLDAP Foundation All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms