Create a PEM from a PPK file

SshPuttyOpensshPem

Ssh Problem Overview


So there are plenty of tutorials on how to convert a PEM to a PPK using puttyGen. However my issue is that my windows machine had the only PEM copy and I converted it into a PPK and deleted it. Now I need to figure out how to convert a PPK into a PEM so that my mac can ssh into the server. I still have access to the server so I could also just make a new key if I had to, anyone know how to convert PPK to PEM?

Ssh Solutions


Solution 1 - Ssh

  1. Install PuttyTools

     apt-get install putty-tools
    
  2. Generate a pem file form the ppk

     puttygen server.ppk -O private-openssh -o server.pem  
    

The file server.pem file will be saved on same location

Solution 2 - Ssh

If you're on a Mac and you've previously installed Homebrew, from Terminal:

$ brew install putty
$ puttygen server.ppk -O private-openssh -o server.pem

The first command was suggested in this comment and the second from Emizen Tech's answer.

Solution 3 - Ssh

Try this to install putty-tools

sudo apt install putty-tools
puttygen key.ppk -O private-openssh -o key.pem
ssh -i ~/key.pem {user}@{ip}

Solution 4 - Ssh

First, install PuTTY for Mac using

brew install putty

Then, use the following command to convert the .ppk format private key to a standard PEM format private key:

puttygen privatekey.ppk -O private-openssh -o privatekey.pem

Make sure permissions on the private key file are set properly. It should only be readable by the user that owns it.

chmod go-rw privatekey.pem

You can now use the key for logins from scripts and command line with:

ssh -i privatekey.pem user@hostname

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCMOSView Question on Stackoverflow
Solution 1 - SshEmizen TechView Answer on Stackoverflow
Solution 2 - SshKenny EvittView Answer on Stackoverflow
Solution 3 - SshJayanta MukherjeeView Answer on Stackoverflow
Solution 4 - SshSalman IftikharView Answer on Stackoverflow