Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon AWS EC2 - Getting a .cer file instead of .pem

When i downloaded my private key file from Security Credentials, I got a .cer file instead of a .pem. I tried to ssh to my ec2 instance using that but i am constantly getting:

Bad passphrase, try again for pk-xxxxxxxxxxx

Is it because i have a .cer file or because i need a pass phrase? I do not know what is a passphrase. I would really appreciate if i can be helped soon. I think i am confusing the the .cer files i get from X.509 with the file i need for ssh. But the problem is i never get .pem files, only .cer file

like image 555
ueg1990 Avatar asked Apr 22 '14 16:04

ueg1990


People also ask

Where is PEM file on EC2 instance?

The pem key (private key) file is on your local PC. The EC2 machine has only the public key. If you want to scp from one EC2 to another EC2 instance that are launched using the same keypair, you have to transfer your pem key file to one of your EC2 machines.


2 Answers

I have just started working on the Amazon AWS platform and came across this question.

Not sure if you managed to resolve your issue - however, here is a AWS forum thread that talks of a related issue and the solution:

ssh error: "Enter passphrase for key 'id_rsa-gsg-keypair'"

To summarize the thread - the problem seems to be with the permissions on the .cer file that was downloaded.

Another thing about the .cer file - A .cer file is essentially confirmant with the PEM format and hence there should be no problem using the .cer file just like you would use a .PEM file.

I downloaded my .cer file and was able to connect to my Amazon Linux instance using it after having the correct permissions (chmod 400 mykey.cer) and then using it in the ssh command as below:

ssh -i mykey.cer ec2-user@public-dns-of-my-amazon-instance

Probably the connecting user varies for other linux instances. More information here

like image 64
Prahalad Deshpande Avatar answered Sep 19 '22 09:09

Prahalad Deshpande


Try downloading the file in a different browser I had similar trouble when I was downloading ec2 instance using Brave Browser but didn't have any trouble when I used safari.

chmod 400 mykey.pem

ssh -i mykey.pem [email protected]

like image 28
Venkatesh Panchariya Avatar answered Sep 20 '22 09:09

Venkatesh Panchariya