Why does pam_mount ask for password?
Ran into the same problem.
Turns out the problem is solved by adding the disable_interactive
option next to pam_mount.so
in the config files ( /etc/pam.d/common-{auth,session}
).
It comes right after pam_mount.so
and the options are separated with spaces (from the so
file name and between each two options).
When the pam_mount.so
code gets executed upon a login, it'll receive the password from the top of the stack and use that password to decrypt your volume.
When you're doing su
from a root session, no password is required and therefore pam_mount.so
will not get any password. So, without the disable_interactive
option, it will try to obtain the password.
Fortunately, as you can see from https://sourceforge.net/p/pam-mount/pam-mount/ci/master/tree/src/pam_mount.c , line 493, pam_mount
will try to proceed even without a password, which is good, because the password isn't needed if the volume is already unlocked and mounted.