Forrest logo
back to the ldapsearch tool

ldapsearch:tldr:1bde6

ldapsearch: Return 5 items that match the given filter.
$ ldapsearch -D '${admin_DN}' -w '${password}' -h ${ldap_host} -b ${base_ou} '${memberOf=group1}' -z 5 displayName
try on your machine

This command is using the ldapsearch tool to search for LDAP entries that have the attribute "displayName" and are a member of the group with the name "group1". Here is an explanation of each parameter used:

  • ldapsearch: The name of the tool being used to perform the LDAP search.

  • -D '${admin_DN}': Specifies the distinguished name (DN) of the user that will be used to bind to the LDAP server. The value '${admin_DN}' is a placeholder that should be replaced with the actual DN.

  • -w '${password}': Specifies the password for the user defined in the -D parameter. The value '${password}' is a placeholder that should be replaced with the actual password.

  • -h ${ldap_host}: Specifies the hostname or IP address of the LDAP server to connect to. The value ${ldap_host} is a placeholder that should be replaced with the actual server host.

  • -b ${base_ou}: Specifies the base distinguished name (DN) to start the search from. The value ${base_ou} is a placeholder that should be replaced with the actual base DN.

  • '${memberOf=group1}': Specifies the search filter. In this case, it is looking for entries that are members of a group with the name "group1". The value '${memberOf=group1}' is a placeholder that should be replaced with the actual group name.

  • -z 5: Limits the number of search results returned to 5. The value 5 can be replaced with any desired limit.

  • displayName: Specifies the attribute to retrieve for the search results. In this case, it is the "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.
back to the ldapsearch tool