on my system, the output for ldd /usr/bin/openssl differers between the regular user, root and sudo.
This is the output for the regular user:
$ whoami
myname
$ ldd /usr/bin/openssl linux-vdso.so.1 (0x00007fff5bdd0000) libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f609a783000) libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f609a4a8000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f609a271000) /lib64/ld-linux-x86-64.so.2 (0x00007f609a8db000)This is the output for the regular user sudo-ing into root:
$ sudo whoami
root
$ sudo ldd /usr/bin/openssl linux-vdso.so.1 (0x00007ffc5d75a000) libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f4092062000) libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f4091ba6000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f409197e000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4091979000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4091974000) /lib64/ld-linux-x86-64.so.2 (0x00007f40923bc000)This is the output for root:
$ sudo su
$ whoami
root
$ ldd /usr/bin/openssl linux-vdso.so.1 (0x00007ffcccffe000) libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f4915593000) libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f49152b8000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4915081000) /lib64/ld-linux-x86-64.so.2 (0x00007f49156eb000)This is the output for the regular user sudo-ing into the bind9 user:
$ sudo -u bind whoami
bind
$ sudo -u bind ldd /usr/bin/openssl linux-vdso.so.1 (0x00007ffdcabb2000) libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f53973d4000) libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f5396f18000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5396cf0000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5396ceb000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5396ce6000) /lib64/ld-linux-x86-64.so.2 (0x00007f539772e000)I'd like sudo to yield the same result that the regular user and root already have. How can I do this?
LD_LIBRARY_PATH is not identical among the environments, but I do not know how to make the values identical.
$ echo $LD_LIBRARY_PATH
/usr/lib/x86_64-linux-gnu
$
$ sudo bash -c 'echo $LD_LIBRARY_PATH'
$
$ sudo su
$ echo $LD_LIBRARY_PATH
/usr/lib/x86_64-linux-gnu
$
$ sudo -u bind bash -c 'echo $LD_LIBRARY_PATH'
$I believe that the answer to this will solve this bind-related question.
81 Answer
It turns out that the problem was that I had two different versions of certain libraries installed, which caused OpenSSL to behave differently depending on whether the user was using sudo or not.
Removing those libraries and running ldconfig afterwards solved the problem for me:
sudo rm /lib/x86_64-linux-gnu/libssl.so.1.1
sudo rm /lib/x86_64-linux-gnu/libcrypto.so.1.1
sudo ldconfigThanks to @waltinator and @Tilman for their comments.