Setting up public key authentication to Linux server from Windows (ppk private key)

Solution 1:

To avoid common pitfalls when setting up a public key authentication, use ssh-copy-id command/script. As you will have troubles running it on Windows, you can run it on the server itself.

  • In PuTTYgen, load your private key (.ppk);
  • Copy the contents of the box Public key for pasting into OpenSSH authorized_keys file to a clipboard.
  • Paste it into your favorite editor (Windows Notepad will do).
  • Save the contents to a file with .pub extension.
  • Upload the .pub file to the server.
  • Login to the server with an SSH client, like PuTTY.
  • On the server type:

    ssh-copy-id -i mykey.pub username@localhost
    

If you do not want to do this manually, you can use WinSCP 5.15. It can setup the public key authentication for you.
Use Tools > Install Public Key into Server button on SSH > Authentication page of WinSCP Advanced Site Settings dialog.

enter image description here

(I'm the author of WinSCP)


Yet another alternative is ssh-copy-id script. On Windows, it comes with Git for Windows. So you may use that locally, if you have it.