arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert PuTTY SSH Key Files to Linux Format
#1
How to convert PuTTY (.ppk) SSH key files to Linux format (.pem)


Hello everyone!

This tutorial is going to be a rather brief guide about how to convert SSH key files created with PuTTY (ppk file extension) to the Linux SSH key file format (pem file extension) so that they can be used with the Linux command line SSH client "ssh".

This tutorial will probably be very helpful for everyone who decided to switch to Linux and use the inbuilt tools instead of installing different / additional SSH clients. In this case you are right here. Unfortunately the Linux ssh client doesn't support the ppk format. Hence why a conversion has to be performed.

P.S.: Yes, there is a Linux version of PuTTY that supports the .ppk format. If you are using the Linux version of PuTTY then this tutorial is not for you. Please move along. Nothing to see here. Don't post a reply saying there is a PuTTY version for Linux. No offense!


First of all you will have to install PuTTY tools. The PuTTY tools package is usually called "putty-tools". It contains command line tools from PuTTY that can be used to create ppk SSH keys, read the content (e.g. public key) and convert the format of these keys (what we want to do).

So start a terminal if you're using a Linux distribution with a GUI or if you are already in a terminal just continue with the commands below.

Commands below have to be performed as root or with sudo!

Debian/Ubuntu/Mint:
apt-get install putty-tools

RHEL/CentOS:
yum install putty

Fedora:
dnf install putty

Arch:
pacman -S putty


Now you can use the PuTTY tool "puttygen" which is the general tool for SSH key creation and management to convert the format.

Run the command below to convert your key and make sure to adjust the key filenames and the path to the keys.

Convert private key:
puttygen /path/to/myprivatekey.ppk -O private-openssh -o /path/to/myprivatekey.pem

Convert publicy key:
puttygen /path/to/myprivatekey.ppk -O public-openssh -o /path/to/mypublickey.pem

If you have a passphrase on your key pair you need to enter your password to allow the converting to proceed.


That's about it! Now you should have .pem files in the folder where your .ppk key files are stored. You can use the .pem files with the Linux ssh client to connect to servers and authenticate yourself. To do so you have to use the -i flag and provide the path to the private key .pem file.

Example:
ssh -p22 [email protected] -i /home/user/keys/server1-private.pem


Enjoy!
[Image: zHHqO5Q.png]



person_pin_circle Users browsing this thread: 2 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting