我在 AWS EC2 上有一個 Ubuntu 12.04LTS 實例,我按照以下網址的說明將其升級到 12.10https://help.ubuntu.com/community/QuantalUpgrades。
升級後我無法再ssh
進入我的虛擬機器。它不接受我的ssh
密鑰,我的密碼也被拒絕。 VM 正在運行、可訪問,並且 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。