2011-08-17 59 views
0

我看到這篇文章:AWS公鑰否認問題

AWS ssh access 'Permission denied (publickey)' issue

的信息有相關性,但並不能幫助我解決我的問題。我曾經能夠使用ec2-user在AWS上使用以下命令登錄到我的Linux實例:

ssh -i key.pem ec2-user @ [address] .compute-1.amazonaws.com from MacBook終端

在過去的幾周裏,我現在收到此錯誤:

「權限被拒絕(公鑰)」。

我試圖

的ssh -v -i key.pem EC2用戶@ [地址] .compute-1.amazonaws.com從我的MacBook終端

,我得到這樣的輸出:

OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011 
debug1: Reading configuration data /etc/ssh_config 
debug1: Connecting to [address].compute-1.amazonaws.com [address] port 22. 
debug1: Connection established. 
debug1: identity file key.pem type -1 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 
debug1: match: OpenSSH_5.3 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_5.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: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Host '[address].compute-1.amazonaws.com' is known and matches the RSA host key. 
debug1: Found key in [path]/.ssh/known_hosts:1 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
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: key.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). 

有什麼建議嗎?如何解決這個問題?

我在這個實例上有我以前創建的另一個用戶帳戶。我可以用它登錄,然後sudo進入根目錄。我不能再使用ec2用戶登錄。

謝謝!

+0

您是否嘗試過致電亞馬遜支持? –

+0

在過去的幾個星期裏,您是否執行過任何操作 - 在AWS中生成新密鑰或在計算機中刪除SSH密鑰等。 – 18bytes

+0

顯然,它看起來像您的SSH密鑰的問題。你有沒有嘗試root用戶? – 18bytes

回答

1

您可能必須以root身份登錄。如果使用比目魚圖像,登錄爲'bitnami'

例如, ssh -v -i key.pem [email protected][address].compute-1.amazonaws.com