Forrest logo
back to the ldapsearch tool

ldapsearch:tldr:a6b8f

ldapsearch: Return all items that are members of at least 1 of the specified groups.
$ ldapsearch -D '${admin_DN}' -w '${password}' -h ${ldap_host} '(|(${memberOf=group1})(${memberOf=group1})(${memberOf=group3}))' displayName
try on your machine

This command is an example of using the ldapsearch tool to search for entries in an LDAP directory. Here is a breakdown of each component:

  • ldapsearch: This is the command itself, which is used to perform searches in an LDAP directory.

  • -D '${admin_DN}': This option specifies the distinguished name (DN) of the user who will perform the search. ${admin_DN} is a placeholder that would be replaced with the actual DN of the user.

  • -w '${password}': This option is used to specify the password of the user specified with the -D option. ${password} is a placeholder that would be replaced with the actual password.

  • -h ${ldap_host}: This option specifies the hostname or IP address of the LDAP server. ${ldap_host} is a placeholder that would be replaced with the actual LDAP server's address.

  • '(|(memberOf=group1)(memberOf=group1)(memberOf=group3))': This is the filter expression used to specify the search criteria. In this case, it is searching for entries that either have a memberOf attribute equals to group1 or group3. The duplicate (memberOf=group1) is likely a typo or a duplication.

  • displayName: This is the attribute that is requested to be returned in the search results. It specifies that the search should return the displayName attribute of matching entries.

Overall, this command would search the LDAP directory for entries that belong to either group1 or group3 and return the displayName attribute of those entries.

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.
back to the ldapsearch tool