LDAP query search filter syntax

less than 1 minute read

LDAP query search filter syntax

LDAP (Lightweight Directory Access Protocol) query filter syntax can be found here

I will mention a few useful ones here:

query = "(cn=*bob*)"; //contains 'bob' anywhere in cn
query = "(&(objectClass=user)(email=*))"; //users which have email
query = "(!(email=*))"; //users witout email
query = "(&(objectClass=user)(| (cn=andy*)(cn=steve*)(cn=margaret*)))"; //user entries with a common name that starts with "andy", "steve", or "margaret"

Leave a comment