One of my clients provided me .ppk file to connect to his server using ssh. As I am a Ubuntu user, I need a key that supports the terminal command. So I decided it convert to a .pem file. I am sharing the steps to convert PPK to PEM format on the Linux terminal using a putty-gen command-line utility.
The Windows Users may like: How to convert a PEM file to PPK?
Method 1: Convert PPK to PEM in Linux
Use the below steps to install the required packages and convert PPK to a pem file.
Step 1 – First of all, install the putty tools on your Linux system using below command.sudo apt-get install putty-tools
Step 2 – Now, convert the ppk file to pem file using puttygen command line tool.puttygen server1.ppk -O private-openssh -o server1.pem
Step 3 – Change the .pem file permissions. Set the read-only permissions to the owner of the file, remove any permission to group and other. Otherwise ssh will refuse this key for use.chmod 400 server1.pem
Step 4 – Finally, connect to your remote Linux server with ssh using this pem key.ssh -i server1.pem [email protected]
Method 2: Convert PPK to PEM in Windows with PuTTYgen
Windows users can also convert a PPK file to PEM using PuTTYgen utility. Assuing you already have downloaded Puttygen from its official download site.
Next, follow the steps to convert PPK to PEM:
- Start PuTTYgen
- Under File menu, click Load private key.
- Select your .ppk file, and then choose Open.
- Now, under the Conversions menu, click Export OpenSSH Key.
- Set a new name with “.pem” extension
8 Comments
how to convert .ppk file to .key file ?
thanks !
Or if you want a script to do it :
#!/bin/bash
[[ “${1##*.}” =~ “ppk” ]] && { puttygen ${1} -O private-openssh -o “${1%.*}.pem”; chmod 400 “${1%.*}.pem”; } || { puttygen ${1} -o “${1%.*}.ppk” -O private; chmod 400 “${1%.*}.ppk”; }
(checks extension and writes a file)
When type:
puttygen key.ppk -O private-openssh -o key.pem
puttygen: unable to load file `key.ppk’: unable to open file
What is this?
what is [username] in
ssh -i server1.pem [username]@11.22.33.44
I am using my ftp username, and again it is asking for password
Thank You Its Worked..
thanks!
Thanks it worked!