ssh - 无法通过 ssh 连接到 ec2 实例

标签 ssh amazon-ec2

您好,当我尝试通过 ssh 进入我新创建的 ec2 实例时,ec2 免费层的许可被拒绝,我搜索了论坛并尝试了提供的解决方案,但无济于事。我将非常感谢任何帮助。这是我所做的

首先使用以下内容编辑 ~/.bashrc

export EC2_PRIVATE_KEY=$HOME/ec2/pk-4JGFV4LMAHPSI2RLN46Z2U5DSQ7F3IUO.pem
export EC2_CERT=$HOME/ec2/cert-4JGFV4LMAHPSI2RLN46Z2U5DSQ7F3IUO.pem
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/

然后
source ~/.bashrc
ec2-add-keypair ec2-keypair > ~/ec2/smitchell.pem

然后我通过 web gui 创建了实例,然后我尝试通过
ssh -v -i/home/smitchell/ec2/smitchell.pem root@ec2-50-17-66-200.compute-1.amazonaws.com

命令结果如下
OpenSSH_5.3p1 Debian-3ubuntu6, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-50-17-66-200.compute-1.amazonaws.com [50.17.66.200] port 22.
debug1: Connection established.
debug1: identity file /home/smitchell/ec2/smitchell.pem type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu3
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu6
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: Host 'ec2-50-17-66-200.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/smitchell/.ssh/known_hosts:3
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: Offering public key: smitchell.pem
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/smitchell/ec2/smitchell.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).

再次感谢您提供的任何帮助

最佳答案

我设法通过网络配置删除实例和我的 key 对并重新生成它们来直接登录,一旦我这样做,我就可以登录。感谢大家的帮助

关于ssh - 无法通过 ssh 连接到 ec2 实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6195086/

相关文章:

ssh - Putty ssh 命令压缩此文件夹中的所有文件,然后下载

amazon-web-services - 为什么 EC2 Autoscaling 仅支持 Classic Load Balancer?

amazon-web-services - 我需要支付 AWS Elastic IP 费用

linux - 从 bash 脚本替换文件中的字符串

java - 如何从 Java 中的 RESTful 服务进行 API 调用?

amazon-web-services - EC2 实例的功能是否按比例扩展?

encryption - 将 AWS 凭证作为用户数据传递给 EC2 实例的最佳方法是什么?

ssh - 具有一个公共(public) IP 的 Docker 容器

bash - 将 bash 启动文件带入 ssh 吗?

GitLab SSH 推送失败内存 malloc 失败错误