1

I have Ubuntu 14.04 server (LAMP), running on Amazon ec2. On my client machine I run Putty with imported SSH key. Session is saved, so there is no changes always. I had no errors during connection and everything was fine. But today I've made apt-get update and reboot. Now I see Using username "ubuntu". Server refused our key error and promt to enter password. I've already tried to Stop and Start instace, but that doesn't help.

  • Did you double check that your Putty session is still pointing to the private key under Connection - SSH - Auth? Putty does not save changes to session automatically. – David Levesque Oct 8 '14 at 14:50
  • Yes, I've checked it. I've used Save session button previously. – Max Power Oct 8 '14 at 16:48
  • Now I have another error. Server unexpectedly closed network connection – Max Power Oct 8 '14 at 19:02
  • Sorry if this sounds stupid, but are you sure you're connecting to the right instance? The public dns and ip address may change when you stop/start, unless you have an Elastic IP assigned. – David Levesque Oct 8 '14 at 19:07
  • @David Levesque Yes, I'm sure, that it's right instance and I have Elastic IP assigned. Restarted the server 1 more time. I've tried both Public DNS and IP for connection. It's refusing my key and wants password. – Max Power Oct 8 '14 at 19:30
0

If nothing else works, what you could do is to create an AMI image from your current instance, and then launch a new instance from that AMI. When you launch the new instance, you will have the option to create a new private key or use an existing one. If you can connect to the new instance, just terminate the old one and reassign the Elastic IP to the new one.

Edit: If you still can't connect to the new instance, you could fire a new instance (using a vanilla Ubuntu AMI, not your own) and then mount the EBS volume of your broken instance into the new instance. This would allow you to have access to the filesystem of the broken instance and maybe find a way to fix it, or at least, copy files from it. The detailed steps are described in this post.

  • Done it. Got the same error during connection with new ip and key. – Max Power Oct 8 '14 at 21:01
  • So you created a new key, downloaded it and converted the private key using PuttyGen? – David Levesque Oct 8 '14 at 21:07
  • Yes, thats right, I've done it after performing steps in your answer. It looks like there are some problems with SSH service in image after update. – Max Power Oct 8 '14 at 21:12
  • That's odd. See my edit. – David Levesque Oct 8 '14 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.