Through ssh connecting to ec2 instance error?

  • ssh -i AWSKeyPair.pem ec2-user@ipaddress
  • Error Permission denied (publickey).
  • pem file is valid file for to connect an ec2 instance.
  • ssh -v -i AWSKeyPair.pem ec2-user@ipaddress
  • 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

  • chmod 600 AWSKeyPair.pem

    and then try connecting again.


  • Kindly Check if ssh port is allowed in security group or not for the machine from which you are doing ssh.
  • If you believe the key is correct then i would suggest you to convert that .pem file to .ppk and then try to connect with putty from your machine. For which you have to open 22 port from you specified ip address in security group.
  • Kindly check your .pem file permission whether it is read only or not. If it is read only then kindly change file permission to 644 and then try.
  • 链接地址: http://www.djcxy.com/p/38982.html

    上一篇: 如何在没有PEM密钥的情况下ssh进入EC2实例?

    下一篇: 通过ssh连接到ec2实例错误?