AWS 连接错误:权限被拒绝(公钥)

AWS 连接错误:权限被拒绝(公钥)

抱歉,如果您觉得这听起来有些多余,但请相信我,事实并非如此。我尝试了与此问题相关的几乎大部分链接,但到目前为止,没有任何方法对我有用。我甚至尝试了这篇文章二。以下是我迄今为止尝试过的方法

  1. 密钥许可 400 以及 600
  2. ubuntu 作为用户名,因为它是 Ubuntu 14.04
  3. IP 是正确的,我甚至还尝试了公共 DNS
  4. 密钥已附加到实例
  5. 使用 FireFox 浏览器的 AWS Java 客户端 (MindTerm)。但是,当我按下 Enter 键时,它显示针对我的 IP 的这一行,然后出现错误。即使我很幸运,它只会询问我提供的用户名(ubuntu),然后退出并显示错误“I/O 错误 - 读取失败:未知错误”,或者只是让我回到 IP 步骤。

MindTerm home: /home/waqas/.mindterm/
SSH Server/Alias: 54.191.37.141
Connected to server running SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2

Server's hostkey (ssh-rsa) fingerprint:
openssh md5:  95:44:f1:40:07:90:00:2a:7d:9a:1f:49:a1:71:8a:0b
bubblebabble: xilon-segen-tufep-manir-rekad-lucag-fetoz-sover-hyhuh-kafiz-kixox

在出现此问题之前,我做的最后一件事是 2 天前,我尝试使用此链接在客户端上安装 FTP 服务器http://www.krizna.com/ubuntu/setup-ftp-server-on-ubuntu-14-04-vsftpd/。不幸的是,此链接没有按预期工作,我最终无法成功登录 FTP。今天,当我尝试使用我的密钥对登录时,它给出了错误。

以下是我的 ssh 尝试的日志

waqas@waqas-itu:~/Downloads/key$ ssh -v -i test.pem [email protected]
OpenSSH_6.0p1 Debian-3ubuntu1.2, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 54.191.37.141 [54.191.37.141] port 22.
debug1: Connection established.
debug1: identity file test.pem type -1
debug1: identity file test.pem-cert type -1
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: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-3ubuntu1.2
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 80:dd:8f:50:a3:80:81:00:39:06:e4:05:6e:f3:1f:16
debug1: Host '54.191.37.141' is known and matches the ECDSA host key.
debug1: Found key in /home/waqas/.ssh/known_hosts:108
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: testserverpem.pem
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: waqas.jamal@***.com
debug1: Authentications that can continue: publickey
debug1: Trying private key: test.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).

答案1

尝试从 known_hosts 文件中删除密钥,然后重新尝试连接。

这至少应该消除任何“旧”缓存连接

答案2

我在 FTP(SFTP)服务器设置链接中看到一些更改 OpenSSH 和用户配置的操作。这些更改可能是您遇到问题的根源。

假设有一个 EBS 支持的实例,您可以通过关闭实例来解决此问题(如果它不是 EIP,这将导致您的外部 IP 发生变化)。然后分离根卷并将其作为非根卷附加到新主机(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-detaching-volume.html),然后挂载它并修复 openssh 或用户配置。

可能的问题来源:您将登录用户添加到 ftpaccess 组,或者将您的主要用户设置为 /usr/sbin/nologin。

相关内容