无法从ec2服务器连接

时间:2015-06-25 13:17:25

标签: amazon-ec2

我正在尝试登录ec2实例服务器,但是我收到了像

这样的错误
  

ubuntu的身份验证失败太多,

  

拒绝权限(公钥)。

当我使用ssh -i "pem_file" ec2_name@public_ip

连接到服务器时

昨天,当我登录服务器时,它已经工作但是在退出服务器并再次尝试登录后,它给了我上面提到的错误。

4 个答案:

答案 0 :(得分:19)

so if you get this message Too many authentication failures for ubuntu, It's usually because you have tried too many private_keys to authenticate against the user ubuntu in your server. You can get more info here: https://superuser.com/questions/187779/too-many-authentication-failures-for-username Try running this: ssh-add -l ssh-add -D You may have too many keys stored in your local ssh-agent. If you get this: Permission Denied (Public key). generally means that your public key is not in the ~ubuntu/.ssh/authorized_keys file on the server. You can actually debug by creating a snapshot of your EBS volume (if you are using EBS). Then create a new volume from the snapshot and then attach the volume to another running EC2 instance. http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html That way you can see what's in your /home/ubuntu/.ssh/ directory Hope this helps.

答案 1 :(得分:11)

最终对我有用的东西

chmod 400 priv_key.pem               #or what you named it
ssh -o 'IdentitiesOnly yes' -i priv_key.pem ec2-user@ec2-xx-xxx-xx-xxx.eu-west-1.compute.amazonaws.com

答案 2 :(得分:1)

其ubuntu @ publicip不是ec2-user @ publicip

答案 3 :(得分:0)

在我的情况下重启我的MacBook有帮助。