Forrest logo
back to the ldapsearch tool

ldapsearch:tldr:340aa

ldapsearch: Query an LDAP server with a no-newline password file for all items that are a member of the given group and return the object's displayName value.
$ ldapsearch -D '${admin_DN}' -y '${password_file}' -h ${ldap_host} -b ${base_ou} '${memberOf=group1}' displayName
try on your machine

This command is used to perform an LDAP search with specific search parameters. Here is an explanation of each part of the command:

  • ldapsearch: This is the command to perform an LDAP search.

  • -D '${admin_DN}': Specifies the distinguished name (DN) of the user who will perform the search. The ${admin_DN} is likely a placeholder that should be replaced with the actual DN.

  • -y '${password_file}': Specifies the path to a file containing the password for the user specified by -D. The ${password_file} is likely a placeholder that should be replaced with the actual path to the password file.

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

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

  • '${memberOf=group1}': Specifies the LDAP filter to apply during the search. In this case, it searches for records where the attribute memberOf has a value of group1.

  • displayName: Specifies the attribute to return in the search results. In this case, it requests the displayName attribute to be displayed for each record that matches the search criteria.

Overall, this command is used to search an LDAP directory for objects that are members of "group1" and retrieve their display names.

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