Answer the question
In order to leave comments, you need to log in
Ldapsearch: how to get a list of CNs of all users in an OU (and its "subOUs") that have a non-empty mail field?
Actually, subject. I wrote a script that receives an email, position, phone number, etc. via CN. - and using this data generates a corporate signature for Postfix. Now we need to get a list of users who have mail in order to create signature files for all of them.
Answer the question
In order to leave comments, you need to log in
Yes, it’s easier than a steamed turnip:
ldap_basedn="dc=mydomain,dc=loc"
[email protected]
ldap_common_filter="(&(sAMAccountName=*)(mail=*))"
# Do LDAP search and keep results
ldapsearch -D $ldap_binddn -w qwertyasdf -LLL -h 192.168.1.14 \
-b $ldap_basedn -P 3 -a always $ldap_common_filter mail phone другие-атрибуты
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question