In this tutorial we will cover the steps needed to access a remote server via SSH using PuTTY on your Windows machine. PuTTY is one of the most popular SSH clients for Windows. It supports several network protocols such as SSH, SCP, rlogin, telnet etc.
Windows installed on the local computer. PuTTY, PuTTYgen and Pageant programs installed on the local computer. SSH access (command line access to the server) Install PuTTY, PuTTYgen and Pageant
Brief details about the software:
PuTTY – the SSH client.
PuTTYgen - an RSA and DSA key generation utility. We will use it to generate/convert SSH keys.
Pageant - an SSH authentication agent for PuTTY. We will use it to load the SSH private key.
You will need to install the 3 programs on your local computer. The programs can be downloaded from the official PuTTY site.
The installations are straightforward and you should not experience any problems with them.
We will actually need to install three programs on our Windows computer:
****SSH key configuration****
If the remote server is configured with SSH key authentication, you should generate an SSH key pair (public and private keys) on it. If you haven't generated the keys yet, you can do it by following the steps from our tutorial How to set up SSH keys.
Once you have the key pair generated, you need to save the private key in a text file (e.g. privatekey.txt). The key is in OpenSSH format, so we will need to convert it to PPK format in order to be able load it in PuTTY.
We will use the PuTTYgen to convert the key:
Open the PuTTYgen.
Click on the Load button.
Select the file with the private key that you created earlier (in our case privatekey.txt). If a passphrase was set for the key during its generation on the remote server you will be prompted to enter it here.
Once you have loaded the key in PuTTYgen, click on the Save private key button to save the key in the correct SSH format.
The private key is now converted to PPK format. In order to load it, we need to open Pageant program and add the key using the Add key button. You will need once again to enter the passphrase for the key. After we submit the key, it should appear in the Pageant key list. We can click on the Close button in order to minimize the Pageant SSH agent into the system tray.
We are now ready to access the server.
In order to access the remote server via SSH, you need to start the PuTTY program.
You will need to enter your remote server's hostname or IP in the Hostname field and specify a Port. The default port that our containers use is 22. At Connection type section you need to choose SSH.
Once you have entered the correct information click the Open button. This will open a command prompt which will ask you to enter a username. In most cases this would be root.
1) If you are connecting to a remote server with SSH key authentication and you have already added the keys as explained above, you will be successfully connected to the server once you enter the username.
2) If you are connecting to a remote server with SSH password authentication, you will be asked for a password for this username. Once you enter the correct password you will be connected to the server.
On the main PuTTY window we are able to load, save or delete stored sessions. In order to avoid filling in the server details every time we want to access it we can save the session with a desired name and next time just load it before connecting.