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
Amazon web services QWS-OpsWorks“;拒绝许可(公钥)“;,尝试登录到实例时_Amazon Web Services_Ssh_Amazon_Aws Opsworks - Fatal编程技术网

Amazon web services QWS-OpsWorks“;拒绝许可(公钥)“;,尝试登录到实例时

Amazon web services QWS-OpsWorks“;拒绝许可(公钥)“;,尝试登录到实例时,amazon-web-services,ssh,amazon,aws-opsworks,Amazon Web Services,Ssh,Amazon,Aws Opsworks,我在OpsWorks中有两个实例。 首先,我可以使用ssh登录。 第二,如果我添加一个EBS卷,并将其装载到“/mnt/data”或其他任何位置,当我尝试登录时,我会得到: "Permission Denied (publickey)" 要使用ssh,我使用: "ssh -v ubuntu@10.0.2.184" 这是完整的日志: OpenSSH_6.2p2, OpenSSL 1.0.1k-fips 8 Jan 2015 debug1: Reading configuration data

我在OpsWorks中有两个实例。 首先,我可以使用ssh登录。 第二,如果我添加一个EBS卷,并将其装载到“/mnt/data”或其他任何位置,当我尝试登录时,我会得到:

"Permission Denied (publickey)"
要使用ssh,我使用:

"ssh -v ubuntu@10.0.2.184"
这是完整的日志:

OpenSSH_6.2p2, OpenSSL 1.0.1k-fips 8 Jan 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 50: Applying options for *
debug1: Connecting to 10.0.2.184 [10.0.2.184] port 22.
debug1: Connection established.
debug1: identity file /home/ec2-user/.ssh/id_rsa type -1
debug1: identity file /home/ec2-user/.ssh/id_rsa-cert type -1
debug1: identity file /home/ec2-user/.ssh/id_dsa type -1
debug1: identity file /home/ec2-user/.ssh/id_dsa-cert type -1
debug1: identity file /home/ec2-user/.ssh/id_ecdsa type -1
debug1: identity file /home/ec2-user/.ssh/id_ecdsa-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_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA de:82:9f:df:1a:a6:b3:59:11:c5:93:f9:95:57:d4:49
debug1: Host '10.0.2.184' is known and matches the ECDSA host key.
debug1: Found key in /home/ec2-user/.ssh/known_hosts:48
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: Offering RSA public key: imported-openssh-key
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: imported-openssh-key
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: imported-openssh-key
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/ec2-user/.ssh/id_rsa
debug1: Trying private key: /home/ec2-user/.ssh/id_dsa
debug1: Trying private key: /home/ec2-user/.ssh/id_ecdsa
debug1: No more authentication methods to try.
Permission denied (publickey).
如果我没有装载EBS卷,那么它可以正常登录


如何修复此问题?

如果是Amazon Linux EC2实例,那么您应该以EC2用户身份登录,而不是以ubuntu用户身份登录。所以,ssh-vec2-user@10.0.2.184.

它不是Amazon EC2实例,而是Ubuntu实例。正如我在文章中所说的,只要我不为实例分配额外的EBS卷,我就可以正常登录。我可以使用“ssh”ubuntu@10.0.2.184“如果未分配EBS卷,我想不出装载的EBS卷会导致这种情况的原因。我会再次检查我是否实际连接到正确的EC2实例(使用错误的ip/dns名称是一个常见错误),该实例是否使用正确的密钥对启动,以及我是否使用正确的私钥连接。此外,我还将显式地为ssh提供-ixxx.pem选项。请注意,我之前提到过ec2用户,因为您似乎是从Amazon Linux实例(调试日志显示为/home/ec2 user)进行SSHing,所以我只想排除一个简单的错误。请更正,我是从VPC中的NAT实例进行SSHing的。我知道我不知道为什么它会受到EBS卷分配与否的影响;我的意思是,如果我停止实例,然后删除卷,然后重新启动它(相同的实例),并在NAT实例的提示历史中使用相同的ssh命令,那么它将登录;换句话说,除了未连接EBS卷之外,没有其他更改。您可以查看机器上的SSH日志吗?此外,还可以比较这两种情况下的控制台输出(操作|实例设置|获取系统日志),看看在安装EBS卷时启动时是否有任何异常情况?