Tuesday, June 29, 2021

Converting putty formatted ppk private key into ssh formatted private key

Putty used different format of private key compared to openssh. To use putty private key (usually with .ppk extension) with openssh, we need to convert it into openssh formatted private key.

To do this, we need putty tools. To install putty tools:

# apt install putty-tools -y

To convert, just use a command called puttygen, which is part of the putty-tools package

# puttygen myprivatekey.ppk -O private-openssh -o myprivatekey.priv

whereby myprivatekey.ppk is the private key in putty format, -O is to specify what output type we want puttygen to produce and -o is to specify the output file.

Once produced, we can test the private key using ssh command

# ssh myuser@myserver -i myprivatekey.pem

No comments: