This is a follow-up to my previous blog post about setting up a VPS server. In the article, I use the command line SSH client, which is pre-installed on macOS, Linux, and Windows 10 (April 2018 Update). But on older Windows versions, you have to download an SSH client.
In this blog post, I show you how you can install and use the Windows SSH client Putty.
Visit the Putty homepage and download either the installer (.msi) or the individual exe files. To follow the tutorial, you need
Connect with Putty
When you follow the steps in my VPS tutorial, you do this at the beginning, when we have to log in with the root user and password. Start
putty.exe, enter the IP address, select the connection type SSH and click Open. Putty asks for the password and opens the connection.
From here on, you follow the configuration steps in my previous post.
When you have to log in with the unprivileged user
manager, enter the username in the following dialog.
You can save the settings by entering a session name and a click on Save. To load and open a stored configuration, double click on the session name or select the entry and click Load.
When you want to generate keys for the public/key authentication, start
puttygen.exe, select the parameter ED25519, and click Generate. You have to move the mouse a bit, during the key generation, to create some random data.
Enter a Key comment and Key passphrase to protect the private key.
Click Save private key and select any directory. puttygen saves the key into a text file with the ending
.ppk. This file also contains the public key.
Copy the public key into the clipboard.
On the VPS open the
authorized_keys file in a text editor
sudo nano /home/manager/.ssh/authorized_keys
paste the public key from puttygen into the editor, save and close the file (ctrl+o, ctrl+x).
In Putty set the path to the key file in the Connetion -> SSH -> Auth dialog.
Go back to the Session dialog, save the settings, and try to open the connection. Putty should first ask for the private key's passphrase and then establish the SSH connection.
Key management with pageant
If you don't want to enter the passphrase each time you connect to the server, you can add the key to pageant. Start
pageant.exe and add the private key with Add Key. Pageant asks for the passphrase, and while pageant is running, you no longer have to enter the passphrase again.
Try to open the connection with putty. If everything is set up correctly, putty no longer asks for the passphrase as long as pageant is running.
For further information, I recommend reading the following article from Digital Ocean. They describe how you can create a shortcut for pageant that automatically loads the keys.