-1

我想使用 duplicity 0.7.06(通过aptUbuntu 16.04.5 LTS 安装)将本地目录备份到远程服务器。~/.ssh/authorized_keys在远程服务器上设置了一个带有文件的用户帐户。

duplicity命令行如下:

duplicity full --verbosity debug /local/folder scp://remoteuser@remotehost/backup

重复性的调试输出为:

Using archive dir: /foo/bar/.cache/duplicity/bedacf3ab67835c3d614d3773c672c53
Using backup name: bedacf3ab67835c3d614d3773c672c53
Import of duplicity.backends.azurebackend Succeeded
Import of duplicity.backends.b2backend Succeeded
Import of duplicity.backends.botobackend Succeeded
Import of duplicity.backends.cfbackend Succeeded
Import of duplicity.backends.copycombackend Succeeded
Import of duplicity.backends.dpbxbackend Succeeded
Import of duplicity.backends.gdocsbackend Succeeded
Import of duplicity.backends.giobackend Succeeded
Import of duplicity.backends.hsibackend Succeeded
Import of duplicity.backends.hubicbackend Succeeded
Import of duplicity.backends.imapbackend Succeeded
Import of duplicity.backends.lftpbackend Succeeded
Import of duplicity.backends.localbackend Succeeded
Import of duplicity.backends.megabackend Succeeded
Import of duplicity.backends.multibackend Succeeded
Import of duplicity.backends.ncftpbackend Succeeded
Import of duplicity.backends.onedrivebackend Succeeded
Import of duplicity.backends.par2backend Succeeded
Import of duplicity.backends.pydrivebackend Succeeded
Import of duplicity.backends.rsyncbackend Succeeded
Import of duplicity.backends.ssh_paramiko_backend Succeeded
Import of duplicity.backends.ssh_pexpect_backend Succeeded
Import of duplicity.backends.swiftbackend Succeeded
Import of duplicity.backends.sxbackend Succeeded
Import of duplicity.backends.tahoebackend Succeeded
Import of duplicity.backends.webdavbackend Succeeded
ssh: starting thread (client mode): 0x5e398850L
ssh: Local version/idstring: SSH-2.0-paramiko_1.16.0
ssh: Remote version/idstring: SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u3
ssh: Connected (version 2.0, client OpenSSH_7.4p1)
ssh: kex algos:[u'curve25519-sha256', u'curve25519-sha256@libssh.org', u'ecdh-sha2-nistp256', u'ecdh-sha2-nistp384', u'ecdh-sha2-nistp521', u'diffie-hellman-group-exchange-sha256', u'diffie-hellman-group16-sha512', u'diffie-hellman-group18-sha512', u'diffie-hellman-group14-sha256', u'diffie-hellman-group14-sha1'] server key:[u'ssh-rsa', u'rsa-sha2-512', u'rsa-sha2-256', u'ecdsa-sha2-nistp256', u'ssh-ed25519'] client encrypt:[u'chacha20-poly1305@openssh.com', u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com'] server encrypt:[u'chacha20-poly1305@openssh.com', u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com'] client mac:[u'umac-64-etm@openssh.com', u'umac-128-etm@openssh.com', u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-sha1'] server mac:[u'umac-64-etm@openssh.com', u'umac-128-etm@openssh.com', u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-sha1'] client compress:[u'none', u'zlib@openssh.com'] server compress:[u'none', u'zlib@openssh.com'] client lang:[u''] server lang:[u''] kex follows?False
ssh: Kex agreed: diffie-hellman-group-exchange-sha256
ssh: Cipher agreed: aes128-ctr
ssh: MAC agreed: hmac-sha2-256
ssh: Compression agreed: none
ssh: Got server p (2048 bits)
ssh: kex engine KexGexSHA256 specified hash_algo <built-in function openssl_sha256>
/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV
  self._cipher = factory.new(key, *args, **kwargs)
ssh: Switch to new keys ...

稍等片刻,又出现一行:

ssh: EOF in transport thread

我可以通过 SSH 手动连接到远程服务器,而无需使用以下命令指定密码:

ssh remoteuser@remotehost

我也可以在scp不指定密码的情况下复制文件:

scp /some/file remoteuser@remotehost:/home/remoteuser/backup

所以这似乎是重复或 paramiko 的问题。

根据“关于 SSH 后端的说明”手册部分,我在 duplicity 命令行中尝试了各种 SSH 后端:

帕拉米科+SCP

导致上述问题。

帕拉米科+sftp

导致上述问题。

pexpect+scp

ImportError: No module named pexpect

pexpect+sftp

ImportError: No module named pexpect

lftp+scp:

这在安装后有效lftp,但是,它需要密码身份验证,并且授权密钥无法按预期工作。

4

1 回答 1

3

paramiko 1.16 和 duplicity 0.7.06 已经很老了。尝试升级到最新版本(paramiko 1.18.x 或 2.4.x 和 duplicity 0.7.18.x)并查看问题是否解决。闻起来像 paramiko 问题。

如果没有,请安装 python-pexpect 并使用 openssh 二进制文件使用 ssh 后端,如果它在命令行上正常工作,那应该可以工作。

..ede/duply.net

于 2018-10-24T16:03:14.240 回答