ldapsearch logical AND

[problem]

You want to match more than one field, in your LDAP search.

[/problem]

[solution]

To match more than one field we use the ampersand – “&” with ldapsearch.

[/solution]

[example]

This is how to perform a logical AND LDAP search.


ldapsearch -x -v-D"cn=Manager,dc=demo,dc=net"-w secret
-b"dc=demo,dc=net" "(&(givenname=John)(sn=Smith))"

[/example]

[reference]

[tags]ldapsearch syntax, openldap ldapsearch, LDAP Training School[/tags]

[/reference]

If you have found my website useful, please consider buying me a coffee below 😉

Leave a Reply

Your email address will not be published. Required fields are marked *