![Forrest logo](/images/logo.png)
ldapsearch:tldr:bee0f
ldapsearch: Invert the filter.
$ ldapsearch -D '${admin_DN}' -w '${password}' -h ${ldap_host} -b ${base_ou} '(!(memberOf=${group1}))' displayName
try on your machine
This command is using the ldapsearch
utility to search for LDAP entries that meet certain criteria. Here's a breakdown of the command:
ldapsearch
: Command to perform an LDAP search.-D '${admin_DN}'
: Specifies the distinguished name (DN) of the user to bind as for the search.${admin_DN}
is a placeholder that should be replaced with the actual DN of the admin user.-w '${password}'
: Specifies the password for the admin user.${password}
is a placeholder that should be replaced with the actual password.-h ${ldap_host}
: Specifies the LDAP server host.${ldap_host}
is a placeholder that should be replaced with the actual LDAP server's hostname or IP address.-b ${base_ou}
: Specifies the base DN (distinguished name) where the search should start.${base_ou}
is a placeholder that should be replaced with the actual base DN.'(!(memberOf=${group1}))'
: Specifies the search filter.memberOf=${group1}
means it will search for entries that are a member of${group1}
. The exclamation mark (!
) at the beginning means it negates the condition, so it will search for entries that are not a member of${group1}
.displayName
: Specifies the attribute to display in the search results. In this case, it is searching for thedisplayName
attribute of the entries.
Overall, this command performs an LDAP search for entries that are not a member of ${group1}
and displays their displayName
attribute.
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.