How can I mount an encrypted home directory upon SSH login using private/public key to authenticate?

2

1

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="~" />

Georg Schölly

Posted 2010-10-29T13:06:18.740

Reputation: 1 146

Answers

1

~/.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.

Vitaly Kushner

Posted 2010-10-29T13:06:18.740

Reputation: 1 360

0

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...

RobotHumans

Posted 2010-10-29T13:06:18.740

Reputation: 5 758