Backing up with Duplicity over SSH

I’m attempting to set up Duplicity as a backup tool, running from cron over ssh, to backup my home directory to another server.

I of course already have passwordless SSH set up to connect to that server, and use ssh-agent to store the passphrase for my SSH key, as described in another entry. However, I could not get passwordless SSH to work from a cron job. If anyone has tips on how to do that, I’d love to hear it.

So I created a second SSH public/private key pair with no passphrase, (in ~/.ssh/backup and ~/.ssh/backup.pub) and figured out how to have Duplicity call ssh, scp, and sftp with the correct parameters to specify the new key pair. (There’s about a zillion different ways of specifying that, and only ONE that works across all three programs.)

The passphrase mentioned here is the one used to encrypt the duplicity backups.

PASSPHRASE=’YourPassphraseGoesHere’ duplicity \
–no-print-statistics \
–ssh-options “-oIdentityFile=/home/schof/.ssh/backup” \
/home/schof \
scp://johnmarkschofield@example.com/duplicity

Comments 2

  1. charles wrote:

    Hey, this might be just what I was looking for.

    Posted 09 Jul 2008 at 2:04 pm
  2. Hampus wrote:

    Note that it should be two normal dashes in –ssh-options, not a html entity dash as is written on this page.

    I copied/pasted the text from here and it took me an hour to realise that it is.

    Posted 13 Jul 2010 at 8:17 am

Post a Comment

Your email is never published nor shared. Required fields are marked *