Forrest logo
back to the ldapsearch tool

ldapsearch:tldr:f8062

ldapsearch: Wait up to 7 seconds for a response.
$ ldapsearch -D '${admin_DN}' -w '${password}' -h ${ldap_host} -b ${base_ou} '${memberOf=group1}' -l 7 displayName
try on your machine

This command is used to perform an LDAP search for entries that belong to the group named "group1" and have a "displayName" attribute. Here's a breakdown of the command:

  • ldapsearch: The main command used to search for entries in an LDAP directory.
  • -D '${admin_DN}': Specifies the distinguished name (DN) of the user who will perform the search. In this case, the DN is provided as the value of the ${admin_DN} variable.
  • -w '${password}': Specifies the password for the user specified by the -D option. The actual password is provided using the ${password} variable.
  • -h ${ldap_host}: Specifies the LDAP server's host name or IP address. The value is provided using the ${ldap_host} variable.
  • -b ${base_ou}: Sets the search base or starting point for the search. The ${base_ou} variable contains the base organizational unit (OU) where the search will begin.
  • '${memberOf=group1}': Specifies the LDAP filter to search for entries that are members of the group with the common name "group1". The filter is enclosed in single quotes.
  • -l 7: Limits the search to a maximum of 7 entries. This is the maximum number of results that will be returned.
  • displayName: Defines the attribute to be retrieved and displayed for each matching entry. In this case, the "displayName" attribute will be returned for the matching 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