'OpenLDAP - return value of UID using only ldapsearch
I'd like ldapsearch to return only the value of the UID of a user based on a specified mail address. I can make it work with the following query:
ldapsearch -H ldap://localhost -w '...' -D "cn...com" -b "ou...com" mail=... -LLL uid | grep 'uid:' | cut -d ' ' -f2-
This gives the desired result, but requires 2 other Linux commands.
If I remove the Linux commands, the output is:
dn: uid=...,ou=...
uid: ...
Q: Is it possible to retrieve the UID value based on a mail address, with only using command ldapsearch?
Note, I do not like to add arguments -tt, since that will write the variable to a file, which is undesired.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
