Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Raionale: I want to be able to automatically make backups to a remote machine, which will be encrypted with ecryptfs.

The title says it all:

I set up ecryptfs-utils on my Debian Squeeze box, and set up one user to use it via ecryptfs-setup-private. When I log in via SSH using password authentication, the ~/Private directory automatically gets mounted.

How can I achieve that ~/Private also automatically gets mounted when logging in via SSH using public key authentication? Obviously, the best solution would be if ecryptfs could somehow 'use' the SSH public key to en/decrypt the data (I know that then using the user's password would not be able to en/decrypt the data any more; this would be acceptable). Probably, this will not work. So perhaps somehow call ecryptfs-mount-private via ssh before logging in via public key? Probably, then I would need to somehow pipe the passphrase through the SSH connection, right? So I would need to store it on the source machine's file system. Not nice either. Any other ideas?

share|improve this question

You will have to either store the password to disk, or provide it when SSH'ing. There is no other reliable way.

(sshd does not know your private key, it can only ask the client for proof that you have it.)

share|improve this answer
thanks, that's what i feared. i know sshd doesn't know the private key; i simply had the hope that ecryptfs would somehow integrate with sshd to uncrypt. – andreas-h Feb 3 '11 at 9:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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