Permission denied when I SSH access to EC2 instance

0 votes

Please help me, when I am trying to connect to my EC2 instance using SSH, I am getting a key error message. Please help me rectify it.

Permission denied (publickey)

This is the error I am getting.

Mar 12 in AWS by Ramya Mantri
97 views

1 answer to this question.

0 votes

These are common reasons that can cause this error are as follows:

  1. Trying to connect with the wrong key. Are you sure this instance is using this keypair?
  2. Trying to connect with the wrong username. ubuntu is the username for the ubuntu based AWS distribution, but on some others it's ec2-user (or admin on some Debians, according to Bogdan Kulbida's answer)(can also be root, fedora, see below)
  3. Trying to connect the wrong host. Is that the right host you are trying to log in to?

Note: This will also happen if you have messed up the /home/<username>/.ssh/authorized_keysfile on your EC2 instance.

answered Mar 12 by Reema

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Unable to initiate ssh connection to Amazon EC2 instance

The keypair which you are using must ...READ MORE

answered Sep 5, 2018 in AWS by Archana
• 4,090 points
44 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to make a S3 bucket public?

create a bucket policy with the following ...READ MORE

answered Mar 12 in AWS by Reena
40 views
0 votes
1 answer