amazon-web-servicessshamazon-ec2putty

Connect to EC2 instance with PuTTY, server refuses key


I have started an EC2 instance that I cannot connect to using PuTTY. I'm using a key pair that I created using PuTTYgen and then imported to AWS. I have specified the private key file on the client side in Connection -> SSH -> Auth. I have SSH on port 22 selected for PuTTY. The EC2 instance has a single security group, and this group has an inbound rule allowing TCP on port 22 from my home laptop's IP address. Still no joy when I try to connect.

In the PuTTY window I see this:

Using username "ec2-user".
Server refused our key

Also an error dialogue box pops up with this message:

Disconnected: No supported authentication methods available (server sent publickey)

What other things should I look into or do differently? I have been successful with this before so I know that it can work, but apparently I've forgotten one or more pieces of the puzzle.


Solution

  • Which Linux distribution are you using? ec2-user is only valid for Amazon Linux. If you use another Linux distribution user is root or ubuntu (for Ubuntu Linux).