4
您好,我試圖SSH到我新創建的EC2實例時,我在EC2免費層獲得權限被拒絕,我有搜索論壇,並嘗試提供的解決方案無濟於事。我會非常感謝任何幫助。這是我做了什麼無法SSH到EC2實例
第一次編輯〜/ .bashrc中有以下
export EC2_PRIVATE_KEY=$HOME/ec2/pk-4JGFV4LMAHPSI2RLN46Z2U5DSQ7F3IUO.pem
export EC2_CERT=$HOME/ec2/cert-4JGFV4LMAHPSI2RLN46Z2U5DSQ7F3IUO.pem
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
然後
source ~/.bashrc
ec2-add-keypair ec2-keypair > ~/ec2/smitchell.pem
然後,我通過網絡GUI創建的實例,然後我試着SSH方式經由 SSH -v -i /home/smitchell/ec2/smitchell.pem [email protected]
該命令導致以下
OpenSSH_5.3p1 Debian-3ubuntu6, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-50-17-66-200.compute-1.amazonaws.com [50.17.66.200] port 22.
debug1: Connection established.
debug1: identity file /home/smitchell/ec2/smitchell.pem type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu3
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu6
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 'ec2-50-17-66-200.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/smitchell/.ssh/known_hosts:3
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: Offering public key: smitchell.pem
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/smitchell/ec2/smitchell.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).
再次感謝您的幫助,您可以提供
您是否已將公鑰上傳到EC2實例的'〜/ .ssh/authorized_keys'文件中? 'ls -ld〜〜/ .ssh〜/ .ssh/authorized_keys'的結果是什麼?即使你是組中唯一的成員,sshd對於有組寫入(也可能是組讀取)訪問的文件都很挑剔。 – sarnold 2011-06-01 00:47:21
我沒有將我的ssh密鑰上傳到實例,我該怎麼做? 另外輸出'代碼'ls -ld〜〜/ .ssh〜/ .ssh/authorized_keys'code'爲 drwxr-xr-x 67 smitchell smitchell 24576 2011-05-31 20:17/home/smitchell drwx ------ 2 smitchell smitchell 8 2011-05-31 19:58 /home/smitchell/.ssh – mitchellsg 2011-06-01 00:50:56
@Mitchellsg:http://alestic.com/2010/10/ec2-ssh-keys – sarnold 2011-06-01 00:52:07