2013-06-24 79 views
1

我似乎無法使用SSH連接到AWS,但我通常沒有任何問題與github或heroku。調試如下,我試過@ubuntu和@ ec2-user(它應該是@ubuntu),我也試着在.ssh(在windows)上創建一個配置文件並添加'ChallengeResponseAuthentication yes'修復它在另一個線程,但沒有運氣。我已經將.pem文件的權限修改爲400.我不明白爲什麼它說這聽起來很正面,但是失敗了,如果我能更好地瞭解錯誤是什麼,我可能能夠找到解決方案。非常感謝任何幫助!ssh to aws權限被拒絕(公鑰)使用ubuntu @爲什麼失敗?

$ ssh -v -i futurebot2.pem [email protected] 
OpenSSH_6.2p2, OpenSSL 1.0.1e 11 Feb 2013 
debug1: Reading configuration data /home/Mark/.ssh/config 
debug1: Connecting to ec2-54-218-75-37.us-west-2.compute.amazonaws.com [54.218.75.37] port 22. 
debug1: Connection established. 
debug1: identity file futurebot2.pem type -1 
debug1: identity file futurebot2.pem-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_5.9p1 Debian-5ubuntu1 
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH_5* 
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 f2:cd:94:4d:a1:9a:b5:67:cb:f7:91:d7:ef:4d:a4:3d 
debug1: Host 'ec2-54-218-75-37.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key. 
debug1: Found key in /home/Mark/.ssh/known_hosts:1 
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: Trying private key: futurebot2.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). 

回答

2

這可能發生的兩個原因。

  1. 用戶不存在,這可能是由於與錯誤的用戶或實例,它是不是你自己的(錯誤的IP地址)連接

  2. 用戶沒有你的鑰匙在其授權密鑰文件。在AWS中,您在啓動時選擇的密鑰會添加到您的實例中,但如果您想使用其他密鑰,則需要手動將它們添加到authorized_keys文件中。

+0

得到了,謝謝。我將它設置爲一對,創建另一個,因爲它似乎沒有工作,但它仍然使用舊對。用這對新設置一個新的實例使它工作。非常感謝! – iammarkhammond