Puttygen pem format

For a concise summary, skip to the end!

Recently, I was given access to a server which requires key authentication using a PuTTY key (with the extension .ppk).

So I tried the usual:

$ ssh -i /path/to/my_key.ppk username@host But it asked me for a passphrase, which I never set:

Enter passphrase for key '/path/to/my_key.ppk' After some digging around, it turns out PuTTY uses a different key format than the de facto standard - OpenSSH.

Because of this, ssh didn't recognise the key format and assumed it was encrytped by a passphrase.

So there are two ways you can use the PuTTY key to login to the server and/or transfer files:

  • Convert the PuTTY private key (.ppk) to a PEM-formatted file (the 'normal' private key format used by OpenSSH) and ssh/sftp in the usual way; or
  • Use a PuTTY SSH client to login and pscp to transfer files

Converting the .ppk to PEM

This is probably the most convenient way as you only have to run one command and everything would be like it was before:

puttygen my_key.ppk -O private-openssh -o openssh_key Now you can run the command again as before, but this time you should be granted access automatically.

$ ssh -i /path/to/openssh_key username@host [username@host ~]$ The same is true for sftp:

$ ssh -i /path/to/openssh_key username@host Connected to host. sftp >

Login using PuTTY SSH Client
First, download the PuTTY SSH Client. If you're using a Linux distribution, check the package repositories as well (PuTTY is such an old ancient program you practically don't need to ensure it's up-to-date)

Open up the client and under Session, input your host's name or IP address. If you're server's default SSH port has been changed, input the port number too.

Next, go to SSH > Auth and browse for your private key.

After that, click 'Open'.

It will prompt you for the username, enter it

login as: and if your credentials are correct, be given access to the server.

login as: username Authenticating with public key "rsa-key-username" [username@host ~]$

Transferring Files using pscp
Transferring files the pscp command is similar to using the sftp command:

Puttygen co to jest

Puttygen program

Puttygen pem to PPK

Puttygen key format

Puttygen.exe help