0 votes
1 view
in AWS by (8.9k points)
edited by

I want to use my Amazon ec2 instance but faced the following error:

Permission denied (publickey).

I have created my key pair and downloaded .pem file.

Given:

chmod  600 pem file.

Then, this command

ssh -i /home/kashif/serverkey.pem  [email protected]

But have this error:

Permission denied (publickey)

1 Answer

0 votes
by (18.5k points)

There could be various reasons for why your authentication is failing. 

  • First of all, make sure that you are using the correct key pair. I know it sounds trivial but it could actually be an issue in cases like these.
  • Check if the username that you are using is correct or not. For ubuntu based AWS AMIs, the valid username is ubuntu, on others, it's ec2-user.
  • Check if you are connecting to the right host.
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...