![Forrest logo](/images/logo.png)
ldapsearch:tldr:3d3df
ldapsearch: Query an LDAP server for all items that are a member of the given group and return the object's displayName value.
$ ldapsearch -D '${admin_DN}' -w '${password}' -h ${ldap_host} -b ${base_ou} '${memberOf=group1}' displayName
try on your machine
This command is used to perform an LDAP search.
Here is the explanation of each argument in the command:
- ldapsearch: This is the command itself, used to initiate an LDAP search operation.
- -D: This option specifies the DN (Distinguished Name) of the user that will be used for authentication. '${admin_DN}' is a placeholder for the actual DN of the LDAP admin user.
- -w: This option is used to provide the password for the authenticated user specified by -D option. '${password}' is a placeholder for the actual password of the LDAP admin user.
- -h: This option specifies the hostname or IP address of the LDAP server. ${ldap_host} is a placeholder for the actual host or IP.
- -b: This option specifies the base DN (Distinguished Name) under which the search will be performed. ${base_ou} is a placeholder for the actual DN of the base organizational unit.
- '${memberOf=group1}': This is the search filter used to specify the LDAP search criteria. In this case, it searches for entries where the 'memberOf' attribute equals 'group1'.
- displayName: This is the attribute we want to retrieve in the search results. In this case, it retrieves 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.