4.3. Query Person

The command below displays all attributes for each entry where all three simple filters are true, matching on attributes objectClass, givenName, and sn (surname). Filters like these would be expected to work in any common LDAP server product.

ldapsearch \
    '( &
        (objectClass=person)
        (givenName=John)
        (sn=Doe)
    )' \
    '*' +

The command below displays all attributes for each entry where both simple filters are true, matching on attributes objectClass, and uid (a.k.a. userid --- a system login name). Filters like these would be expected to work in many common LDAP server products. Attribute uid is defined for Microsoft Active Directory, but it may not be used.

ldapsearch \
    '( &
        (objectClass=person)
        (uid=jxd1234)
    )' \
    '*' +

Common LDAP attributes related to persons are provided in RFC 4519.