Skip to content

Instantly share code, notes, and snippets.

@ekreutz
Created November 24, 2023 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekreutz/8ea8c9df2efcf98c60582136a7b6dcd4 to your computer and use it in GitHub Desktop.
Save ekreutz/8ea8c9df2efcf98c60582136a7b6dcd4 to your computer and use it in GitHub Desktop.
Convert OpenSSH private key to PEM file format

Convert OpenSSH private key to PEM file format

Assuming that your ssh private key is located at ~/.ssh/id_rsa. We will convert this file to the PEM format.

# Change dir to home directory
cd ~

# Make a copy of the private key and store the copy in the home directory
cp ~/.ssh/id_rsa ~/id_isa_copy

# Convert the copy to the PEM format
ssh-keygen -p -f ./id_isa_copy -m PEM

After this, the file at ~/id_rsa_copy is in the PEM format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment