I have created the amazon linux instance and now I have to config the instance using my ubuntu terminal via ssh. I followed the instructions given in the aws document but I am getting an error which says "permission denied" public key issue. I am newbie to ssh and also to the amazon web services kindly help me


When you generated your key pair, you should have saved your private key to your local machine. Once this is done, you SSH to your remote instance using the following command:

ssh -i <path to private key file> ubuntu@<host>

Your <host> will be the entry listed next to 'Public DNS' in the EC2 website. It will look something like 'ec2-00-00-00-00.compute-X.amazonaws.com'


Did you download the .pem file to


make sure it's permissions are correct

chmod 400 $HOME/.ssh/SomeFileName.pem

make sure that $HOME/.ssh has the correct permissions too

chmod 700 $HOME/.ssh

then try to connect (use your own .pem filename and AWS hostname) e.g.

ssh -i SomeFileName.pem ec2-user@ec2-184-72-214-132.compute-1.amazonaws.com

If this doesn't help then please edit your original message with the output of

ssh -v -i SomeFileName.pem ec2-user@ec2-184-72-214-132.compute-1.amazonaws.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.