Ssh – Backup a remote directory with duplicity

backupduplicityssh

Is it possible to backup a remote directory to a local path?

Using two URL in the command raises

Two URLs specified.  One argument should be a path.

Using only one for the remote but specifying the full option raises

--full option cannot be used when restoring or verifying

What I tried looks like

duplicity full ssh://username@remote:XXXX/home/username /media/removabledrive/

with XXXX being a custom port for ssh.

Best Answer

Why not just mount the remote path into your local filesystem tree using sshfs, cifs, nfs or some other facility of your choosing?

If you do that, you can specify two local paths to duplicity and it shouldn't notice that one of the paths is actually on a remote node (make sure you choose the remote file system that exports attributes like permissions etc. in a way you want and also make sure you use correct mount options - which is especially important for samba/cifs, since its defaults are not very unix-ish).

For a Debian or Debian derivatives (like Ubuntu):

apt-get install sshfs

Then:

mkdir -p /mnt/remote &&
sshfs username@remote:/home/username /mnt/remote

After that succeeds, do your backup from /mnt/remote to your local backup path, then

umount /mnt/remote

Also check out man sshfs to see what options might apply to your use case.

Related Topic