![Forrest logo](/images/logo.png)
ldapsearch:tldr:85efe
ldapsearch: Combine multiple boolean logic filters.
$ ldapsearch -D '${admin_DN}' -w '${password}' -h ${ldap_host} '(&(${memberOf=group1})(${memberOf=group2})(!(${memberOf=group3})))' displayName
try on your machine
This command performs an LDAP search using the ldapsearch utility. Here is an explanation of the different parts of the command:
ldapsearch
: This is the command itself, used for searching an LDAP directory.-D '${admin_DN}'
: This option specifies the distinguished name (DN) of the LDAP user to bind as. The${admin_DN}
is a placeholder for the actual DN value, which needs to be provided.-w '${password}'
: This option specifies the password for the LDAP user to bind as. The${password}
is a placeholder for the actual password, which needs to be provided.-h ${ldap_host}
: This option specifies the LDAP server hostname or IP address to connect to. The${ldap_host}
is a placeholder for the actual hostname or IP address, which needs to be provided.'(&(${memberOf=group1})(${memberOf=group2})(!(${memberOf=group3})))'
: This is the LDAP search filter. It uses the LDAP query syntax to define the search criteria. In this case, the filter is looking for LDAP entries that satisfy the following conditions:- The entry should be a member of
group1
. - The entry should be a member of
group2
. - The entry should not be a member of
group3
.
- The entry should be a member of
displayName
: This is the attribute to be retrieved for the matching entries. In this case, the search result will include thedisplayName
attribute for each matching entry.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.