Login SSH with .ppk file on Ubuntu Terminal

208,451

Solution 1

If you only have .ppk file then it would be useful to create a .pem file and then connect to your server using that.

In you Ubuntu computer, install putty-tools with the following command:

sudo apt-get install putty-tools

Now convert your .ppk file to .pem using the following command:

puttygen yourkey.ppk -O private-openssh -o yourkey.pem

Set the proper permission to use the .pem file with following command:

chmod 400 yourkey.pem

Now connect to your server using the below command:

ssh -i yourkey.pem serverusername@server-ip

Hope it helps.

Solution 2

You can convert a .ppk file in ubuntu with installing putty-tools. So

apt-get install putty-tools

Then youn can convert the .ppk file with puttygen to OpenSSH's format like so:

puttygen <the_key.ppk> -O private-openssh -o <new_openssh_key>.key

Solution 3

.ppk is a file format used by Windows program PuTTYgen.

You can try the following procedure published by Kaleb Pederson on StackOverflow:

puttygen supports exporting your private key to an OpenSSH compatible format. You can then use OpenSSH tools to recreate the public key.

  1. Open PuttyGen
  2. Click Load
  3. Load your private key
  4. Go to Conversions->Export OpenSSH and export your private key
  5. Copy your private key to ~/.ssh/id_dsa (or id_rsa).
  6. Create the RFC 4716 version of the public key using ssh-keygen

    ssh-keygen -e -f ~/.ssh/id_dsa > ~/.ssh/id_dsa_com.pub
    
  7. 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
    

Solution 4

Install the putty tools, if you don`t have on Linux:

sudo apt-get install putty-tools

Generate the pem file run the following command:

puttygen keyname.ppk -O private-openssh -o keyname.pem

Place the pemkey.pem file in your ~/.ssh directory:

cp keyname.pem ~/.ssh

Set the pem file to have the proper permissions:

chmod 400 keyname.pem

Thats it.

Share:
208,451

Related videos on Youtube

techraf
Author by

techraf

This user really prefers to keep an air of mystery about them.

Updated on September 18, 2022

Comments

  • techraf
    techraf almost 2 years

    I have a production server. To login to the server I must use a .ppk file.

    How to login with Ubuntu Terminal and .ppk file?

    I tried this :

    ssh -i location/file.ppk username@server-ip
    

    but it is showing an error message.

  • mckenzm
    mckenzm about 6 years
    Highest answer to mention .pem and permissions.
  • mckenzm
    mckenzm about 6 years
    You can do this "off system" if you cannot get putty-tools.
  • Budi Mulyo
    Budi Mulyo over 4 years
    for me, @finn answer can't solve, but this could solve my problem, thanks.
  • Bariq Dharmawan
    Bariq Dharmawan over 3 years
    This should be higher vote and accepted answer
  • Martin Braun
    Martin Braun over 3 years
    If you found this solution as a Mac user, you won't find any putty-tools. Simply do brew install putty and you will have puttygen, eventually.
  • Abdul Rehman
    Abdul Rehman over 2 years
    This answer shows that a little extra details and well written/formated answer is way more helpful than a plain syntax or documentation link
  • Konrad Grzyb
    Konrad Grzyb over 2 years
    uudecode failed when trying to convert ssh-keygen -i -f ~/.ssh/id_dsa_com.pub > ~/.ssh/id_dsa.pub
  • Mayank-Dolphin
    Mayank-Dolphin over 2 years
    Thanks it's working for me.