麻烦连接到Amazon EC2上的SSH [英] Trouble connecting to Amazon EC2 over SSH

查看:221
本文介绍了麻烦连接到Amazon EC2上的SSH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图连接到我的亚马逊EC2实例。当您连接错误 - 权限被拒绝(公钥)。安装cmhod 400 myPem.pem文件没有帮助。 连接日志:

  

OpenSSH_6.2p2,OSSLShim 0.9.8r二○一一年十二月八日DEBUG1:阅读   配置数据的/ etc / ssh_config中DEBUG1:在/ etc / ssh_config中第20行:   对于* DEBUG1应用选项:连接到54.214.31.168   [54.214.31.168]端口22 DEBUG1:连接建立。 DEBUG1:   标识文件wenglePemNew.pem类型-1 DEBUG1:标识文件   wenglePemNew.pem证书类型-1 DEBUG1:启用兼容模式   协议2.0 DEBUG1:本地版本字符串SSH-2.0-OpenSSH_6.2 DEBUG1:   远程协议版本2.0,远程软件版本OpenSSH_5.9p1   Debian的5ubuntu1 DEBUG1:比赛:OpenSSH_5.9p1 Debian的5ubuntu1拍   OpenSSH_5 * DEBUG1:SSH2_MSG_KEXINIT发送DEBUG1:SSH2_MSG_KEXINIT   收到DEBUG1:KEX:服务器 - >客户端AES128-CTR HMAC-MD5无DEBUG1:   KEX:客户端 - >服务器AES128-CTR HMAC-MD5无DEBUG1:   SSH2_MSG_KEX_DH_GEX_REQUEST(1024< 1024< 8192)发DEBUG1:期待   SSH2_MSG_KEX_DH_GEX_GROUP DEBUG1:SSH2_MSG_KEX_DH_GEX_INIT发   DEBUG1:期待SSH2_MSG_KEX_DH_GEX_REPLY DEBUG1:服务器主机密钥:   RSA(code)主办'54 .214.31.168(54.214.31.168)的真实性   不能成立。 RSA密钥指纹(code)。你确定你   要继续连接(是/否)?是无法将主机添加到   已知主机(/Users/oktolab/.ssh/known_hosts)的清单。 DEBUG1:   ssh_rsa_verify:签名正确DEBUG1:发送SSH2_MSG_NEWKEYS   DEBUG1:期待SSH2_MSG_NEWKEYS DEBUG1:收到SSH2_MSG_NEWKEYS   DEBUG1:漫游不允许通过服务器DEBUG1:SSH2_MSG_SERVICE_REQUEST   发送DEBUG1:SSH2_MSG_SERVICE_ACCEPT收到DEBUG1:认证   可以继续:公钥DEBUG1:下一个身份验证方法:   公钥DEBUG1:尝试私钥:wenglePemNew.pem DEBUG1:阅读   PEM私钥进行:类型RSA DEBUG1:身份验证,可以   继续:公钥DEBUG1:没有更多的认证方法去尝试。   权限被拒绝(公钥)。

AMI创建和部署一个新的实例的一个新的PEM文件并没有帮助。

什么是需要做的,连接到服务器?

解决方案
  

无法将主机添加到已知主机列表(/Users/oktolab/.ssh/known_hosts)

什么是 /Users/oktolab/.ssh/known_hosts

许可

下面的命令来运行修复权限:

  CHMOD 0600 /Users/oktolab/.ssh/known_hosts
 

另外,你能提供您所运行的确切SSH命令,因为:

  

阅读PEM私钥进行:类型RSA DEBUG1:身份验证,可以继续:公钥DEBUG1:没有更多的认证方法去尝试。权限被拒绝(公钥)。

如果你使用了大量的时间上面的错误出现 EC2用户而不是的Ubuntu 作为用户名和副反之亦然。在你的情况,这似乎是Ubuntu的图像,它应该是的Ubuntu 。这些东西将被澄清,一旦你提供确切的SSH命令,你正在运行

I'm trying to connect to my EC2 Instances on Amazon. When you connect an error - Permission denied (publickey). Installing cmhod 400 myPem.pem file does not help. Connection log:

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 debug1: Reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: Applying options for * debug1: Connecting to 54.214.31.168 [54.214.31.168] port 22. debug1: Connection established. debug1: identity file wenglePemNew.pem type -1 debug1: identity file wenglePemNew.pem-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.2 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1 debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH_5* debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: RSA (code) The authenticity of host '54.214.31.168 (54.214.31.168)' can't be established. RSA key fingerprint is (code). Are you sure you want to continue connecting (yes/no)? yes Failed to add the host to the list of known hosts (/Users/oktolab/.ssh/known_hosts). debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server 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: wenglePemNew.pem debug1: read PEM private key done: type RSA debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. Permission denied (publickey).

AMI creation and deployment of a new instance with a new pem file did not help.

What's need to do to connect to the server?

解决方案

Failed to add the host to the list of known hosts (/Users/oktolab/.ssh/known_hosts)

What are the permission for /Users/oktolab/.ssh/known_hosts ?

Run below command to fix the permission:

chmod 0600 /Users/oktolab/.ssh/known_hosts

Also, could you provide the exact SSH command that you are running because:

read PEM private key done: type RSA debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. Permission denied (publickey).

A lot of time above error appears if you use ec2-user instead of ubuntu as username and vice-versa. In your case, this seems to be ubuntu image so it should be ubuntu. These things will be clarified once you provide the exact ssh command you are running

这篇关于麻烦连接到Amazon EC2上的SSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆