February 2011
« Jan   Mar »

Amazon EC2 ” Server refused our key”

Few days before I have started quick a Amazon server setup for hosting a new ruby project. Definitely I would relay on the AMI provided by Amazon for my small instance type (ami-76f0061f ). My desktop is windows machine.

After the 3-4 hours of ssh access, whenever I tried to login to the server using private key, it throws me an error ” Server refused our key” which I don’t understand.
Finally I lost access to that server and caused me a time waist-age. Again I started building from the scratch and same thing is happen even I set ssh restriction in “security group” My colleague says that it was a ssh hacking attempt and hackers can gain access to your server over ssh when you start to receive such errors.

The first thing I did is, changed IP I were used before.( there is a hack behind this, if you have only one IP and want to change the ip, first you have “allocate ” new ip and then release the old IP.)

I can get the ssh access during the reboot time in some cases.

The last time, I understood that it’s something related to ssh authentication problem and I needs to override this .private key type authentication.

Fix is
a. Replace the sshd-config(/etc/ssh/) from my Centos 5.4 with the Amazon server
b. Deleted the ~./.ssh/authorized keys.
c. Restarted the sshd server.
# service sshd restart

After this, there is no any issue with ssh and I could able to validate the ssh login with user name and password. Simply override the AMAZON bumps 🙂 that caused me only worreis 🙁

Moral of the story.
Create a Private AMI as soon as initial hostingis completed. Do not keep your data on EBS root device (OS drive)

3 comments to Amazon EC2 ” Server refused our key”

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>