31
votes

I am new to Amazon EC2 and trying to configure it. I have created the instances and trying to connect. I am getting the error as "Disconnected : No supported authentication methods available (server sent :publickey)".

I have got the keypair from EC2 Management console and have used putty gen to generate private key file(PPK).

Kindly assist to resolve.

I have already referred Google server putty connect 'Disconnected: No supported authentication methods available (server sent: publickey) but couldn't get my problem resolved.Error screen

7
Which Linux distribution?David Levesque
Your login may not be ec2-user. It can vary depending on AMI.datasage
@DavidLevesque : Ubuntu Linux - 64 Bitexplorer
@datasage : Thanks a lot.I have tried Amazon linux instance and have used ec2-user as user name.Getting logged in. But I am unable to access my public IP from my browser.explorer
@RameshJothimani In that case you need to make sure you have a web server running and port 80 is open.datasage

7 Answers

39
votes

For the record, the usual default username in EC2 for these Linux distro:

  • Amazon Linux: ec2-user
  • Ubuntu: ubuntu
  • Debian : admin

To access the instance through a browser, make sure you add a rule in your security group to allow port 80 and port 443 inbound.

2
votes

I was having the exact same problem on Amazon EC2 and I simply changed my username to "ubuntu" and it made a connection.

2
votes

Use the public dns name instead of IP. In the putty, choose connection > SSH > Auth. You will see the Authentication Parameter part, in there you can choose your ppk file.

And one more very important thing. Click the "Allow attempted changes of username in SSH-2" to activate it.

1
votes

I had the same problem even with ec2-user, I used Public DNS instead of Public IP. It resolved now.

1
votes

It's important to understand that if your instance is created by any any other service (like Elastic Beanstalk) and not directly from EC2, you are likely to face similar problems.

It is possible the there is no Key pair associated with your instance yet. To validate this go to your instance from

EC2 dashboard > Description

Look out for 'Key pair name' there. If there is a valid value there (this must the same you used to generate the key from Putty Key Generator) then this suspicion can be overruled. Otherwise you may need to recreate instance as a worst case scenario.

In my case, the instance was create by Elastic Beanstalk i.e. EBS (another AWS service) where I hosted a web application, I attached an existing key pair to the EBS environment and the connection through Putty went through.

0
votes

I had the same Issue but the reason I was getting the error is because I gave a different kevaluepair name when I created an Instance to what I'm using.

Make sure that the key value pair name is same across all situations.

0
votes

I had a similar problem,resolved using the correct username and loading .ppk file properly.

Username in EC2 varies depending upon AMI machine, Use following logins on following AMIs:

ubuntu or root on ubuntu AMIs ec2-user on Amazon Linux AMI centos on Centos AMI debian or root on Debian AMIs ec2-user or fedora on Fedora ec2-user or root on: RHEL AMI, SUSE AMI, other ones.

If you are using OS:

Windows - get PEM key from AWS website and generate PPK file using PuttyGen. Then use Putty to use the PPK (select it using left-column: Connection->SSH->Auth: Private key for authorization)

Linux - run: ssh -i your-ssh-key.pem login@IP-or-DNS Find Full Documentation here and here