Ldapsearch

From Wikitech
Jump to navigation Jump to search

Show a user by shell account name (laner):

ldapsearch -x uid=laner

Show a user by wiki name (underscore "_" becomes space " ") (User:Ryan_Lane):

ldapsearch -x "cn=Ryan Lane"

You can also add \* + to the above queries to return all user attributes

ldapsearch -x uid=laner \* +
ldapsearch -x "cn=Ryan Lane" \*

Alternatively you can return only the attributes you are interested in

ldapsearch -x uid=laner mail,uid
ldapsearch -x "cn=Ryan Lane" uid createTimestamp mail cn sn

Search for all users with a wikimedia.org email address

ldapsearch -x 'mail=*@wikimedia.org'

Search all users created after a specific date

ldapsearch -x "createTimestamp>=20190316100000Z" uid createTimestamp mail

Search for all users withe a wikimedia.org email address created after a specific date

ldapsearch -x "(&(mail=*@wikimedia.org)(createTimestamp>=20190316100000Z))" uid createTimestamp mail cn sn