ubuntu - Permission denied (publickey) on Amazon EC2 and can't access server -


i know lot of questions 1 have been asked none of them seem help.

i added new users ec2 instance , tried give 1 ssh access. must have messed because can't ssh access account anymore. i'm running ubuntu server , have ssh'd many times today , stopped working.

i've found lot of different fixes none of worked. include:

using ssh-keygen -r [server ip]

chmod 400 on .pem file

attaching ebs volume new instance

other sites suggests messed permissions on /home folder on server. without access, how can fix these permissions? i've tried many things i'm starting feel i'm making worse.

for reference, when try ssh using ssh -i wachtwoord.pem ubuntu@52.30.172.181 -vvv following output:

wouters-macbook-pro:aws wouter$ ssh -i wachtwoord.pem ubuntu@52.30.172.181 -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 * debug1: /etc/ssh/ssh_config line 102: applying options * debug2: ssh_connect: needpriv 0 debug1: connecting 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 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 52.30.172.181:22 '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 52.30.172.181 debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 debug1: ssh2_msg_kexinit sent debug1: ssh2_msg_kexinit received debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,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: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-ed25519,ssh-rsa,ssh-dss debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib debug2: kex_parse_kexinit: none,zlib@openssh.com,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: curve25519-sha256@libssh.org,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,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: none,zlib@openssh.com debug2: kex_parse_kexinit: none,zlib@openssh.com 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 chacha20-poly1305@openssh.com <implicit> none debug1: kex: client->server chacha20-poly1305@openssh.com <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 52.30.172.181 debug1: host '52.30.172.181' known , matches 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 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 can continue: publickey debug3: start over, passed 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: sent publickey packet, wait reply debug1: authentications can continue: publickey debug1: trying private key: wachtwoord.pem debug3: sign_and_send_pubkey: rsa sha256:rgznqr6kyfs9io0cgwz3z4tkd0wevoqbovmypuqsfvk debug2: sent publickey packet, wait reply debug1: authentications can continue: publickey debug2: did not send packet, disable method debug1: no more authentication methods try. permission denied (publickey). 

if know problem related key pairs, can:

  • stop instance
  • detach boot disk
  • attach boot disk instance (as non-boot disk)
  • copy keys, change permissions, etc
  • detach disk
  • reattach original instance
  • start original instance
  • login!

see articles:


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -