I am trying to upload my first duplicity backup to a remote server and it fails. It is the first time I am using the tool and it did not work before.

duplicity /home/me/Documents/ scp://me@<ip-address>//home/me/bak

This is the answer I get:

BackendException: ssh connection to me@<ip-address>:22 failed: Private key file is encrypted
DEBUG:duplicity:BackendException: ssh connection to me@<ip-address>:22 failed: Private key file is encrypted

Logging in via ssh works fine.

I have searched the web but could not find any possible solution. My only hunch is that it could be related to my .ssh directory: which contains multiple identities and thus multiple .pub and key files

EDIT: with -v 9 I get the following output (a lot more, but just showing last part):

ssh: Kex agreed: curve25519-sha256@libssh.org
DEBUG:sshbackend:Kex agreed: curve25519-sha256@libssh.org
ssh: HostKey agreed: ssh-ed25519
DEBUG:sshbackend:HostKey agreed: ssh-ed25519
ssh: Cipher agreed: aes128-ctr
DEBUG:sshbackend:Cipher agreed: aes128-ctr
ssh: MAC agreed: hmac-sha2-256
DEBUG:sshbackend:MAC agreed: hmac-sha2-256
ssh: Compression agreed: none
DEBUG:sshbackend:Compression agreed: none
ssh: kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
DEBUG:sshbackend:kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
ssh: Switch to new keys ...
DEBUG:sshbackend:Switch to new keys ...
Using temporary directory /tmp/duplicity-O8U6r5-tempdir
Level 5:duplicity:Using temporary directory /tmp/duplicity-O8U6r5-tempdir
Backend error detail: Traceback (innermost last):
  File "/usr/bin/duplicity", line 1581, in <module>
  File "/usr/bin/duplicity", line 1567, in with_tempdir
  File "/usr/bin/duplicity", line 1406, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/duplicity/commandline.py", line 1140, in ProcessCommandLine
    backup, local_pathname = set_backend(args[0], args[1])
  File "/usr/lib/python2.7/site-packages/duplicity/commandline.py", line 1015, in set_backend
    globals.backend = backend.get_backend(bend)
  File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line 223, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line 209, in get_backend_object
    return factory(pu)
  File "/usr/lib/python2.7/site-packages/duplicity/backends/ssh_paramiko_backend.py", line 240, in __init__
    self.config['port'], e))
 BackendException: ssh connection to me@<ip-address>:22 failed: Private key file is encrypted

doesn't tell me much more though

  • pure scp works too – Fabio Sep 10 at 0:07
  • Do you have a password on your SSH key? – Ginnungagap Sep 10 at 6:20
  • yes, my SSH key has a password. Maybe I should try with one without? – Fabio Sep 10 at 19:36
  • I just tried with a key without password and I get the same....:( – Fabio Sep 10 at 19:43

seems like the paramiko backend does not support providing a passphrase for your secret key currently.

try pexpect+scp:// or better pexpect+sftp:// if possible

alternatively specify a secret key you want to use via


and make sure it is not passphrase protected.


  • Attempt 1 failed. ImportError: No module named pexpect – Fabio Sep 11 at 17:11
  • Apparently pexpect is a package and should be installed, but as rsync worked for me, I did not try. Thanks for the help though. – Fabio Sep 18 at 17:41

What actually worked is using rsync as backend.

Which is finally surprising, I have no idea why the scp backend did not work, as pure scp works too.

Won't accept my own answer because it is not really the solution to the problem, just a workaround. But at least I can use it now.

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.