升级到 Ubuntu 12.10 后无法通过 ssh 登录

升级到 Ubuntu 12.10 后无法通过 ssh 登录

我在 AWS EC2 上有一个 Ubuntu 12.04LTS 实例,我按照以下说明将其升级到 12.10https://help.ubuntu.com/community/QuantalUpgrades

升级后,我无法再ssh进入我的虚拟机。它不接受我的ssh密钥,我的密码也被拒绝。虚拟机正在运行、可访问,并且 SSH 已启动。问题似乎出在身份验证部分。

SSH 一直是我访问该虚拟机的唯一方式。我有什么选择?

ubuntu@alice:~$ ssh -v -i .ssh/sos.pem  [email protected]
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /home/ubuntu/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to www.hostname.com [37.37.37.37] port 22.
debug1: Connection established.
debug1: identity file .ssh/sos.pem type -1
debug1: identity file .ssh/sos.pem-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
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: RSA 33:33:33:33:33:33:33:33:33:33:33:33:33:33
debug1: Host '[www.hostname.com]:22' is known and matches the RSA host key.
debug1: Found key in /home/ubuntu/.ssh/known_hosts:12
debug1: ssh_rsa_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,password
debug1: Next authentication method: publickey
debug1: Trying private key: .ssh/sos.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
[email protected]'s password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.

答案1

你确定你的密码正确吗?

否则也许你应该尝试 EC2 支持系统

答案2

检查服务器上的 /var/log/auth.log。它应该会告诉你 sshd 拒绝连接的原因。

答案3

那么,在客户端检查这个文件:/etc/ssh/sshd_config,并确保你有

RSAAuthentication yes
PubkeyAuthentication yes

然后执行以下操作:

sudo grep 'sshd' /var/log/secure | grep 'Authentication refused' | tail -5

如果出现此信息:"Authentication refused: bad ownership or modes for directory",请更改该目录或这些目录的权限:

sudo chmod 0755 directory

然后再试一次。

答案4

尝试确保安装了最新版本的 sshd。如果你已经安装了最新版本,请尝试运行

$sudo apt-get remove --purge ssh

然后重新安装 ssh。

相关内容