Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用ubuntu@拒绝ssh到aws的权限(公钥),为什么失败?_Ssh_Amazon Web Services_Ssh Keys - Fatal编程技术网

使用ubuntu@拒绝ssh到aws的权限(公钥),为什么失败?

使用ubuntu@拒绝ssh到aws的权限(公钥),为什么失败?,ssh,amazon-web-services,ssh-keys,Ssh,Amazon Web Services,Ssh Keys,我似乎无法使用SSH连接到AWS,尽管我在github或heroku上通常没有任何问题。下面是调试,我试过@ubuntu和@ec2 user(应该是@ubuntu),我也试过在.ssh中创建一个配置文件(在windows上)并添加“ChallengeResponseAuthentication yes”,因为这似乎可以在另一个线程上修复它,但运气不好。我已将.pem文件的权限修改为400。我不明白为什么它说这一切听起来都是积极的,但后来失败了,如果我能更好地了解错误是什么,我也许能够找到解决办法

我似乎无法使用SSH连接到AWS,尽管我在github或heroku上通常没有任何问题。下面是调试,我试过@ubuntu和@ec2 user(应该是@ubuntu),我也试过在.ssh中创建一个配置文件(在windows上)并添加“ChallengeResponseAuthentication yes”,因为这似乎可以在另一个线程上修复它,但运气不好。我已将.pem文件的权限修改为400。我不明白为什么它说这一切听起来都是积极的,但后来失败了,如果我能更好地了解错误是什么,我也许能够找到解决办法。非常感谢任何帮助

$ ssh -v -i futurebot2.pem ubuntu@ec2-54-218-75-37.us-west-2.compute.amazonaws.com
OpenSSH_6.2p2, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /home/Mark/.ssh/config
debug1: Connecting to ec2-54-218-75-37.us-west-2.compute.amazonaws.com [54.218.75.37] port 22.
debug1: Connection established.
debug1: identity file futurebot2.pem type -1
debug1: identity file futurebot2.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: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA f2:cd:94:4d:a1:9a:b5:67:cb:f7:91:d7:ef:4d:a4:3d
debug1: Host 'ec2-54-218-75-37.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /home/Mark/.ssh/known_hosts:1
debug1: ssh_ecdsa_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: futurebot2.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).

这可能发生的两个原因

  • 用户不存在,这可能是由于连接了错误的用户或不是您自己的实例(错误的ip地址)

  • 用户的授权密钥文件中没有您的密钥。在AWS中,您在启动时选择的密钥将添加到您的实例中,但如果您想使用其他密钥,则需要手动将它们添加到您的
    授权密钥
    文件中


  • 好的,谢谢。我用一双鞋安装了它,创建了另一双,因为它似乎不起作用,但它仍然使用旧的一双。使用新实例对设置一个新实例使其正常工作。非常感谢!