Convert putty .ppk key to OpenSSH format

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1484
Joined: Fri Aug 29, 2003 8:39 pm

Convert putty .ppk key to OpenSSH format

Post by ^rooker »

[PROBLEM]
I had several SSH keys in PuTTY's internal format ".ppk" and wanted to use them with OpenSSH.

[SOLUTION]
Since I'm using GNU/Linux (K)ubuntu, I did an "apt-get install putty".
Now you have "puttygen" and can do this:

Code: Select all

puttygen mykey.ppk -O private-openssh -o mykey.key
(For Windows: You can probably use "puttygen" application to export it in the GUI)

Note:
If you run "puttygen --help" you can see other options like "public-openssh", etc...
User avatar
^rooker
Site Admin
Posts: 1484
Joined: Fri Aug 29, 2003 8:39 pm

Using the public-key in .ppk for SSH

Post by ^rooker »

In case you simply need to add someone's public key to your "~/.ssh/authorized_hosts" file, but don't have or don't want to use "puttygen", just open it in a text editor.

It will start with something like this:
PuTTY-User-Key-File-2: ssh-rsa
Encryption: aes256-cbc
Comment: My beloved key
Public-Lines: 4
Copy paste the lines following after that until "Private-Lines: x" - copy/paste them to your authorized_keys file and add "ssh-rsa" (or ssh-dsa, or whatever it says in line 1 of your Putty .ppk keyfile).
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply