ldapsearch always outputs an authentication message with every query at the beginning:

SASL/GSS-SPNEGO authentication started
SASL username: [email protected]
SASL data security layer installed.
<regular output>

if I do ldapsearch -o ldif-wrap=no -b cn=<omitted>,cn=groups,dc=lan,dc=<ommited>,dc=de "(cn=<omitted>.nextcloud.users)"|grep -v SASL it doesn't disappear.

If append 2> /dev/null it doesn't help either.

This is annoying I am looking for some way to not show this SASL output when I do ldapsearch queries. The ldapsearch command ist executed against a samba4-LDAP

1 Answer 1


Use -Q to disable SASL-related messages.

ldapsearch -Q cn=whatever

To redirect stderr you need to add 2>/dev/null next to the command which produces stderr output – that is, the redirection must be near ldapsearch, before the | grep ... part.

ldapsearch cn=whatever 2>/dev/null | grep foo

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .