0

I've run into this issue before and rebooting the instance, I assumed, reset the /root/.ssh/authorized_keys and the /home/ubuntu/.ssh/authorized_keys files.

I've reboot the instance twice now and I'm still not able to SSH in. I just get this:

Connection closed by x.x.x.x

Any ideas?

2 Answers 2

1

reset as in delete them and create new files? If so permissions are bad that that is a security check by ssh.

needs to be the following

chown user: ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
3
  • I can't SSH in. Jun 15, 2011 at 4:36
  • yes i know.. so if you have no other account to get in.. you're out of luck
    – Mike
    Jun 15, 2011 at 5:17
  • Thanks! All the other posts mention chmod, but this is the only post that mentions that the .ssh has to be chown to the user. This fixed my problem!
    – James
    Jul 4, 2018 at 20:10
1

Rebooting the instance won't reset those files but taking an AMI of the instance and creating a new instance from the ami will cause cloudinit to redo those files when it injects the ssh key on first boot of the new instance. If that doesn't work then you will need to attach the volume to another healthy instance and fix the files from there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .