lock

Convert a pem file into a rsa private key

lock

When you build a server in AWS one of the last steps is to either acknowledge that you have access to an existing pem file, or to create a new one to use when authenticating to your ec2 server.

If you want to convert that file into an rsa key that you can use in an ssh config file, you can use this handy dandy openssl command string.

openssl rsa -in somefile.pem -out id_rsa

Note: you don’t have to call the output file id_rsa, you will want to make sure that you don’t overwrite an existing id_rsa file.

Copy the id_rsa file to your .ssh directory and make sure to change permissions on the id_rsa key to read only for just your user.

chmod 400 ~/.ssh/id_rsa

2 thoughts on “Convert a pem file into a rsa private key”

  1. Pingback: Convert a pem file to a private key | 0ddn1x: tricks with *nix

  2. Pingback: Convert a PEM file into a RSA private key | 0ddn1x: tricks with *nix

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: