0

Having an ApacheDS LDAP DC in a Docker container, I want to export it as ldiff to the host (not inside the container):

docker exec -it apache-ds sh -c 'ldapsearch -D "uid=admin,ou=system" -W -p 10389 -h localhost -b "dc=my,dc=domain" -s sub "(ObjectClass=*)" * + ' 1> export.ldiff

This works, but with two problems:

  1. The ldiff file starts with Enter LDAP Password: from the promt
  2. The Enter LDAP Password message is not displayed, which is not very intuitive

I could work around #1 with negated grep like this

docker exec -it apache-ds sh -c 'ldapsearch -D "uid=admin,ou=system" -W -p 10389 -h localhost -b "dc=my,dc=domain" -s sub "(ObjectClass=*)" * + ' | grep -v "Enter LDAP Password:" 1> export.ldiff

But i don't feel that this is a clean, intuitive way. So I would like to know if it's possible to display the password promt and only pipe the output of ldapsearch to a file?

The idea is to get the exported file on the host without the need of two steps, e.g. first exporting the file inside the container and then moving the export to the host for further processing.

  • It's not clear from your text whether you want to run this interactively with somebody entering a password or completely non-interactively. – Michael Ströder Aug 16 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.