Is it possible to automatically mount an encrypted partition on the server when logging in using SSH keys instead of the regular password?

The home folder is a luks-encrypted partition. The current pam_mount setting is as follows:

<volume user="name" path="/dev/mapper/my_folder" mountpoint="~" />

~/.ssh/authorized_keys allows you to specify the command that will execute upon ssh login.

You can write a shell script that will mount partition (even ask a password for it) and then "exec bash" or "exec zsh" etc.


It puts another tool into the mix, but using sec might be an option.

"Install sec. Visit the author's website and read the documentation there. Set up sec to monitor /var/log/auth.log and run your script."

from here: http://ubuntuforums.org/showthread.php?t=843736

you could have it run a mount script and add a keyfile for the luks volume to get past entering a password.

That's the best I've got...

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.