Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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 ''

share|improve this answer

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

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

ssh -v -i SomeFileName.pem

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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