I am setting up an ubuntu server to use as remote backup and I plan to use rsync to keep it up-to-date. I've encrypted the home directory though, which now prevents direct connection using standard scp syntax. I've moved my 'authorized_keys' file outside the home directory, so I can ssh into the server and mount the encrypted directory, but is there a way to directly scp into the encrypted home directory, without enabling remote login on the client machines?

1 Answer 1


What I do:

Don't mess with the authorized keys: place the key be inside the home folder as it is mounted by Ubuntu.

I know, this breaks passwordless ssh or scp into the machine because the key is not actually there. Let's find a workaround.

Run ssh username@server from a terminal, so that it will mount your encrypted folder, and now you have your key at the expected directory. (This is the default behavior in Ubuntu, when you ssh into a machine it also calls all the stuff that mounts your encrypted home, just like a local login.)

Leave this terminal open.

From this point on you can launch your scripts or scp commands. If your key had been set properly, it will work seamlessly, without prompting for a password each time.

When you are finished, log off in that terminal that you had left open in first place.

I run it all the time, with the purpose of backup too, and I find it very practical.

I am assuming:

  • This encrypted home on the server actually is the place where you want your backup.
  • You are not running some background process that is making magic with your backups all the time: backups commands are launched by you manually, and eventually they finish.

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.