Accessing a remote host via SSH can be done in two ways – either with a username/password combination or by making use of an SSH key. For the latter option, you can generate a key on the server itself or you can use the key generation capabilities of a third-party software like Putty. Earlier we saw how to perform the former operation by entering into cPanel and creating and authorizing an SSH key. But actually using it to access a remote server is a bit more complex. Linux users have it easy since the operating system has an inbuilt terminal for exactly this kind of situation. Fortunately, Windows users also have an industry standard option called Putty.
Putty is a GUI-based SSH solution that allows both password as well as key generated access to a remote server. Using the public keys we generated in cPanel, we can configure Putty to allow us to sign in without a password once we have a compatible private key. In this tutorial, let’s look at how to transform a generated key on cPanel into one that is accepted by Putty for SSH access.
Downloading the Private Key File
If you’ve gone through the steps for generating a public key on cPanel and authorize it, it would have automatically created a corresponding private key which you need to download. Open up cPanel and find the SSH access icon. The screen will be split into two sections – one holding the public keys, and one holding the private keys. As shown in the screenshot below, scroll to the bottom and click “View/Download”.
In this test example, I’ve created a key called My_Super_Key. Click the “Download” button in order to transfer the file to your local PC.
You now have a corresponding private key as a counterpart to the public key sitting on your server. But now we have to convert this into what is known as a “ppk” file in order to use it with Putty.
Downloading and Generating the Private Key
In order to generate the keys and use Putty, you have to download at least two files from this location. The first is the key generation file as shown below.
The second, is Putty itself.
Select your version and method of download. These are fairly lightweight programs that don’t require any installation. They are standalone EXE files without any dependencies.
Fire up puttygen.exe and you will be given the option to either generate a key pair or load one into the application. As shown below, click the “Load” button and select the private key that you obtained earlier from cPanel.
At this point, you will be asked to enter your private passphrase that was used to create the key in the first place.
Once that is done, Putty will generate the private key that you need to save your desktop to use with the main program. This locally generated file has a “.ppk” extension which renders it compatible with Putty.
To access the remote server using this file, simply open Putty and after clicking on the Session section in the left-hand pane, type in your server IP address or the web host name to which you want to connect.
Next, under “Connections”, enter your username that you normally use to access cPanel as shown below:
Finally under the SSH section click “Auth”, “Browse”, and select the PPK file be generated in the previous steps. Going back to the “Session” section, you can enter a name to save this configuration so that you won’t have to do it again, and click “Open”.
Using the Public/Private key combination on both the main server as well as your local machine, Putty will fire up a secure SSH connection to the remote host.
Of course, you can also skip key authentication entirely and proceed directly to login based identification methods. It’s a question of security and flexibility and you have to decide which one you want to use.