当我使用私钥进行连接时,Duplicity还原报告“无效的SSH密码”

我正在testing恢复0.6.15的副本备份。

我可以使用以下命令和我的私钥使用ssh和sftplogin到我的备份服务器:

SFTP

root@client:~# sftp -oPort=7843 [email protected] Enter passphrase for key '/root/.ssh/id_rsa': Connected to 192.168.xx sftp> exit 

… SSH

 root@client:~# ssh -p7843 [email protected] Enter passphrase for key '/root/.ssh/id_rsa': Connected to 192.168.xx Last Login: .... 

我有以下恢复脚本用于还原签名和encryption备份的内容:

 #!/bin/bash export SIGN_PASSPHRASE='<signed-key-passphrase' export PASSPHRASE='<encryption-passphrase>' duplicity -v9 --encrypt-key="<encryption-key-id>" --sign-key="<signed-key-id>" --force \ scp://[email protected]:7843//home/backupUser/backup /mnt/restore 

但是,当我运行脚本的重复性:

 root@client~#: ./restore_script.sh 

重复使用它来尝试login到我的备份服务器时,Duplicity给我以下错误:

 Using archive dir: /root/.cache/duplicity/b1a470f45b67cd7784bc8e6449383df7 Using backup name: b1a470f45b67cd7784bc8e6449383df7 Import of duplicity.backends.hsibackend Succeeded Import of duplicity.backends.ftpbackend Succeeded Import of duplicity.backends.botobackend Succeeded Import of duplicity.backends.rsyncbackend Succeeded Import of duplicity.backends.imapbackend Succeeded Import of duplicity.backends.localbackend Succeeded Import of duplicity.backends.giobackend Succeeded Import of duplicity.backends.ftpsbackend Succeeded Import of duplicity.backends.cloudfilesbackend Succeeded Import of duplicity.backends.gdocsbackend Succeeded Import of duplicity.backends.tahoebackend Succeeded Import of duplicity.backends.u1backend Succeeded Import of duplicity.backends.webdavbackend Succeeded Import of duplicity.backends.sshbackend Succeeded Main action: restore ================================================================================ duplicity 0.6.15 (August 19, 2011) Args: /usr/bin/duplicity -v9 --encrypt-key=<encryption-key-id> --sign-key=<signature-key-id> --force scp://[email protected]:7843//home/backupUser/backup /mnt/restore Linux client 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:50:42 UTC 2011 i686 i686 /usr/bin/python 2.7.2+ (default, Oct 4 2011, 20:03:08) [GCC 4.6.1] ================================================================================ Using temporary directory /tmp/duplicity-sLukkP-tempdir Registering (mkstemp) temporary file /tmp/duplicity-sLukkP-tempdir/mkstemp-12JD0o-1 Temp has 4995375104 available, backup will use approx 34078720. Running 'sftp -oPort=7843 -oServerAliveInterval=15 -oServerAliveCountMax=2 [email protected]' (attempt #1) State = sftp, Before = 'Enter' State = sftp, Before = '' Invalid SSH password Running 'sftp -oPort=7843 -oServerAliveInterval=15 -oServerAliveCountMax=2 [email protected]' failed (attempt #1) Removing still remembered temporary file /tmp/duplicity-sLukkP-tempdir/mkstemp-12JD0o-1 INT intercepted...exiting. 

我在我的.ssh目录中有一个.ssh ,它应该允许用户使用该密码进行login,而不是要求inputssh-password(我已经在服务器上closures了),所以我不明白为什么服务器是不允许重复login。

这里是我的客户端的.ssh目录,权限和所有的列表:

 root@client:~# ls -la /root/.ssh total 16 drwx------ 2 root root 4096 2011-11-29 01:05 . drwx------ 8 root root 4096 2011-11-29 12:30 .. -rw------- 1 root root 1766 2011-11-29 01:06 id_rsa -rw-r--r-- 1 root root 442 2011-11-29 00:38 known_hosts 

有什么我失踪? 我得到的备份工作得很好,我想testing一下恢复备份之前密封交易在这里,说它的工作原理。

好吧,算了一下。 为了inputssh密钥的密码( 不是 gpgencryption密钥),必须安装和configuration密钥keychain ,并且必须使用ssh-add命令添encryption钥。

我需要安装keychain ,所以我做了,

然后添加我添加到我的.bash_profile像这样:

 keychain --clear id_rsa . ~/.keychain/$HOSTNAME-sh 

现在假设我的公钥与我的私钥一起存储在/root/.ssh目录中,当我将用户切换到root用户时,我首先得到一个错误,但之后运行shh-addexit帐户,并login以root身份重新login。

当我回到root账户时,我被要求inputssh私钥的密码。 现在重复似乎工作…至于连接到另一台服务器无论如何…我不再收到我以前得到的Invalid SSH Password