I was just sent a PEM key from a client as a means to access their Amazon EC2 instance. How do I convert this into something I could use with OpenSSH?
Asked
Active
Viewed 2.1k times
9
-
2Does this [SO question](http://stackoverflow.com/questions/1011572/convert-pem-key-to-ssh-rsa-format) help? – jw013 Aug 05 '11 at 05:29
2 Answers
4
You can extract a PEM public key from an OpenSSH private key using:
openssl rsa -pubout -in .ssh/id_rsa
But OpenSSH has no tools to convert from or too PEM public keys (note: PEM private keys are OpenSSH's native format for protocol 2 keys)
Kevin
- 40,087
- 16
- 88
- 112
Gopinath Karangula
- 156
- 1
2
If you were just sent the private key in the form of keyfile.pem (e.g. for Amazon LightSail VPS) then you can just use it directly as an ssh private key:
ssh -i keyfile.pem ubuntu@dest_ip
Or you can add it to your agent like this:
ssh-add ./keyfile.pem
And then login:
ssh ubuntu@dest_ip
Pierz
- 661
- 9
- 9