I\'ve generated key pairs using PuTTYgen and been logging in using Pageant, so that I have to enter my pass-phrase only once when my system boots.
How do I achieve
puttygen
supports exporting your private key to an OpenSSH compatible format. You can then use OpenSSH tools to recreate the public key.
Conversions->Export OpenSSH
and export your private key~/.ssh/id_dsa
(or id_rsa
).Create the RFC 4716 version of the public key using ssh-keygen
ssh-keygen -e -f ~/.ssh/id_dsa > ~/.ssh/id_dsa_com.pub
Convert the RFC 4716 version of the public key to the OpenSSH format:
ssh-keygen -i -f ~/.ssh/id_dsa_com.pub > ~/.ssh/id_dsa.pub
See this and this for more information.
I recently had this problem as I was moving from Putty for Linux to Remmina for Linux. So I have a lot of PPK files for Putty in my .putty
directory as I've been using it's for 8 years. For this I used a simple for
command for bash shell to do all files:
cd ~/.putty
for X in *.ppk; do puttygen $X -L > ~/.ssh/$(echo $X | sed 's,./,,' | sed 's/.ppk//g').pub; puttygen $X -O private-openssh -o ~/.ssh/$(echo $X | sed 's,./,,' | sed 's/.ppk//g').pvk; done;
Very quick and to the point, got the job done for all files that putty had. If it finds a key with a password it will stop and ask for the password for that key first and then continue.
PPK → OpenSSH RSA with PuttyGen & Docker.
Private key:
docker run --rm -v $(pwd):/app zinuzoid/puttygen private.ppk -O private-openssh -o my-openssh-key
Public key:
docker run --rm -v $(pwd):/app zinuzoid/puttygen private.ppk -L -o my-openssh-key.pub
See also https://hub.docker.com/r/zinuzoid/puttygen
Newer versions of PuTTYgen (mine is 0.64) are able to show the OpenSSH public key to be pasted in the linux system in the .ssh/authorized_keys
file, as shown in the following image:
Alternatively if you want to grab the private and public keys from a PuTTY formated key file you can use puttygen
on *nix systems. For most apt-based systems puttygen
is part of the putty-tools
package.
Outputting a private key from a PuTTY formated keyfile:
$ puttygen keyfile.pem -O private-openssh -o avdev.pvk
For the public key:
$ puttygen keyfile.pem -L
It's probably easier to create your keys under linux and use PuTTYgen to convert the keys to PuTTY format.
PuTTY Faq: A.2.2