PuTTY and ssh keys

To use PuTTY on windows to ssh into a linux machine using a key rather than a password…

On your windows machine

Run the puttygen program included in the PuTTY package and generate your key.


Save the private key (my filename was testprivatekey.ppk) and the public key (I used testpublickey.txt)

Set up the connection in PyTTY, adding your private key.


At the moment, this will fail to connect using the key as we havent copied onto the other machine, so use your password to log in.

On your Linux machine

Copy your public key to this machine and convert to openssh format using ssh-keygen

$ ssh-keygen -i -f testpublickey.txt > puttypublickey.sshformat

Now append the public key to your list of authorised keys

$ cat puttypublickey.sshformat >> .ssh/authorized_keys

In future, your password will not be needed.