2016-06-11 150 views
0

我知道很多像這樣的問題已被問到,但他們都沒有幫助。Amazon EC2上的權限被拒絕(publickey),無法訪問服務器

我將新用戶添加到了我的EC2實例,並試圖給出一個SSH訪問權限。我一定弄錯了一些東西,因爲現在我無法從任何帳戶獲得SSH訪問權限。 我正在運行一個Ubuntu服務器,今天已經SSH多次進入它,它突然停止工作。

我發現了很多不同的修復,但沒有一個工作。它們包括:

using ssh-keygen -R [server ip]

chmod 400 on the .pem file

attaching the EBS volume to a new instance

其它網站提示我搞砸了的東西與我的服務器上的/home文件夾的權限。但沒有訪問權限,我該如何修復這些權限?我嘗試了很多事情,我開始覺得我只是在變得更糟。

作爲參考,當我嘗試使用ssh -i Wachtwoord.pem [email protected] -vvv我得到以下輸出到SSH:

Wouters-MacBook-Pro:AWS Wouter$ ssh -i Wachtwoord.pem [email protected] -vvv 
OpenSSH_6.9p1, LibreSSL 2.1.8 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 20: Applying options for * 
debug1: /etc/ssh/ssh_config line 102: Applying options for * 
debug2: ssh_connect: needpriv 0 
debug1: Connecting to 52.30.172.181 [52.30.172.181] port 22. 
debug1: Connection established. 
debug1: key_load_public: No such file or directory 
debug1: identity file Wachtwoord.pem type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file Wachtwoord.pem-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_6.9 
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6 
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6 pat OpenSSH_6.6.1* compat 0x04000000 
debug2: fd 3 setting O_NONBLOCK 
debug1: Authenticating to 52.30.172.181:22 as 'ubuntu' 
debug3: hostkeys_foreach: reading file "/Users/Wouter/.ssh/known_hosts" 
debug3: record_hostkey: found key type ECDSA in file /Users/Wouter/.ssh/known_hosts:12 
debug3: load_hostkeys: loaded 1 keys from 52.30.172.181 
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug2: kex_parse_kexinit: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ssh-rsa,ssh-dss 
debug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
debug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
debug2: kex_parse_kexinit: none,[email protected],zlib 
debug2: kex_parse_kexinit: none,[email protected],zlib 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519 
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-512-et[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
debug2: kex_parse_kexinit: none,[email protected] 
debug2: kex_parse_kexinit: none,[email protected] 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug1: kex: server->client [email protected] <implicit> none 
debug1: kex: client->server [email protected] <implicit> none 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:y+3H4AJRnfGSdk8J/dSFS9lfUGAblTObro2xkdzgLNQ 
debug3: hostkeys_foreach: reading file "/Users/Wouter/.ssh/known_hosts" 
debug3: record_hostkey: found key type ECDSA in file /Users/Wouter/.ssh/known_hosts:12 
debug3: load_hostkeys: loaded 1 keys from 52.30.172.181 
debug1: Host '52.30.172.181' is known and matches the ECDSA host key. 
debug1: Found key in /Users/Wouter/.ssh/known_hosts:12 
debug2: set_newkeys: mode 1 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug2: set_newkeys: mode 0 
debug1: SSH2_MSG_NEWKEYS received 
debug1: Roaming not allowed by server 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug2: service_accept: ssh-userauth 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug2: key: /Users/Wouter/.ssh/id_rsa (0x7ff692501620), 
debug2: key: Wachtwoord.pem (0x0), explicit 
debug1: Authentications that can continue: publickey 
debug3: start over, passed a different list publickey 
debug3: preferred publickey,keyboard-interactive,password 
debug3: authmethod_lookup publickey 
debug3: remaining preferred: keyboard-interactive,password 
debug3: authmethod_is_enabled publickey 
debug1: Next authentication method: publickey 
debug1: Offering RSA public key: /Users/Wouter/.ssh/id_rsa 
debug3: send_pubkey_test 
debug2: we sent a publickey packet, wait for reply 
debug1: Authentications that can continue: publickey 
debug1: Trying private key: Wachtwoord.pem 
debug3: sign_and_send_pubkey: RSA SHA256:rGZNQr6kyFs9Io0CGwz3z4Tkd0weVOQBoVmyPUQsfvk 
debug2: we sent a publickey packet, wait for reply 
debug1: Authentications that can continue: publickey 
debug2: we did not send a packet, disable method 
debug1: No more authentication methods to try. 
Permission denied (publickey). 
+0

你失去了獲得Ubuntu的用戶嗎? – error2007s

+0

是的,似乎是這樣。因爲當我嘗試使用ubuntu用戶進行連接時,我得到了上面發佈的錯誤 –

+0

嘗試使用一個新密鑰拍攝該實例的圖像並啓動它,然後嘗試是否有用? – error2007s

回答

相關問題