我希望能够ssh到我的节点,然后运行软件,为了自己的目的, ssh到其他机器和本身。 它假定已经设置了ssh密钥,所以它不能使用-i标志并使用它。
我有一个工作正常工作的Xen安装程序,这工作正常:我所要做的只是scp我的私钥到.ssh/id_rsa和公共部分到.ssh/id_rsa.pub (我可以在EC2中恢复,因为它是在.ssh/authorized_keys )。
这个相同的设置在EC2中不起作用。 我已经validation了/etc/ssh/sshd_config和/etc/ssh/ssh_config在我的Xen /etc/ssh/ssh_config上是一样的,而EC2是没有的。
我使用的基础AMI是ami-1774927e ,包含新的Ubuntu Hardy安装的Alestic.com映像。 自然,22号端口是在我的安全组中为sshstream量打开的。
任何想法,我做错了什么?
编辑:根据womble的build议和亚马逊EC2论坛的build议,这里是额外的信息,可能会有所帮助:
sshd_config和ssh_config在我的Xen和EC2盒子上是一样的(而且是早期指定的Alestic ami的默认版本),而且我没有使用任何命令行选项。 ssh-agent没有运行,机器上没有其他的ssh密钥。 我只是以root身份login,而且最重要的是 ,如果我使用-i当键名不是id_rsa时,我可以从同一个框login到我的EC2框。
当我使用-i标志时,ssh -v的尾部看起来像这样:
debug1: Host 'localhost' is known and matches the RSA host key. debug1: Found key in /root/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: ec2scale.key debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). debug1: channel 0: new [client-session] debug1: Entering interactive session. debug1: Sending environment. debug1: Sending env LANG = en_US.UTF-8 Last login: Mon Jul 6 23:42:49 2009 from 127.0.0.1 Linux (none) 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:34:28 EST 2008 x86_64 ... and so on ...
但是当我不使用-i标志时,我得到这个:
debug1: Host 'localhost' is known and matches the RSA host key. debug1: Found key in /root/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: /root/.ssh/identity debug1: Offering public key: /root/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 279 debug1: read PEM private key done: type RSA debug1: Authentications that can continue: publickey debug1: Trying private key: /root/.ssh/id_dsa debug1: No more authentication methods to try. Permission denied (publickey).
我diff了密钥,它们是相同的,我可以看到服务器接受上面的id_rsa密钥,但只是validation不通过。 当我login时检出/var/log/auth.log显示这一点:
Jul 6 23:46:09 ip-10-244-50-159 sshd[1354]: error: RSA_public_decrypt failed: error:0407006A:lib(4):func(112):reason(106)
我可以使用openssl来查看错误代码:
root@ip:~# openssl errstr 0407006A error:0407006A:rsa routines:RSA_padding_check_PKCS1_type_1:block type is not 01
但是我不知道如何使用它来帮助我的问题。
在Amazon EC2论坛上做了很多工作之后,“解决scheme”就是简单地命名除id_rsa以外的其他任何关键字。 由于唯一可以自动使用的其他键名是id_dsa ,因此我命名了它的键和它的工作。 这个线程显示了debugging问题所采取的步骤,在未来的读者遇到类似的问题的情况下,在这里转载。
/etc/ssh/sshd_config /etc/ssh/ssh_config $HOME/.ssh/authorized_keys $HOME/.ssh/config -I和-A ) SSH_*环境variables ssh-agent状态和哪些密钥已经被ssh-add add'ed了 ssh -v -i $HOME/.ssh/id_rsa <REMOTE> ssh -v <REMOTE> strace ssh -v -i $HOME/.ssh/id_rsa <REMOTE> -d运行sshd id_rsa复制到id_dsa来解决,确保没有id_dsa.pub (或者它不起作用) 那么,如果没有auth日志的内容来查看SSH服务器认为正在进行什么,以及SSH客户端的详细运行的输出,我可以提供的唯一的猜测是某些configuration错误。
编辑:所以,除非我误解你,你可以login到EC2机器罚款,除非你不使用正确的密钥?