Searching over first and last name of LDAP users

Searching for users happens most typically in the share dialogue. Administrators also can do searches on the Users page. Some applications, like External File Storage, also use a search field in their configurations.

But what is the search run against? Using the LDAP Backend it is totally configurable. By default, however, only the displayname (or cn as fallback) is used for this. Also, there is no wildcard placed upfront. This mean if you have a user with the displayname Joan Doe you will find here only when typing “Joan”, but not “Doe”. Or, if here displayname is Doe, Joan you will find here by searching for “Doe”, but not when searching for “Joan”.

Better would be, if you can find here by either looking for “Joan” or “Doe”. And this can be achieved by adjusting the User Search Atributes in Admin → LDAP → Advanced → Directory Settings. It is empty by default, thus falling back to whatever is configured as User Display Name Field above. Typically, the sn attribute is used for the last name, and givenName for the first name, but it might depend on your LDAP configuration. Specifying those (one attribute per line, see screenshot below) will make searches run against both attributes and, voilà, you find Doe, Joan by either typing “Doe” or “Joan”.

And if you also want to search email addresses, you can add mail too or any other corresponding attribute or any attribute of interest.

1 Like

5 posts were split to a new topic: Logins with different login names of the same LDAP record result in different Nextcloud users

any chance how to do this with the zimbra drive login? as it is I can only search on the username with is a long UUID number…

depends on which attributes zimbra uses. Also for a proper displayname.