PuTTY – How to Create SSH Keys

You must have heard of SSH keys a lot. What is an SSH key pair? Why do you need it? How do you create a pair? Many questions come. This short tutorial on PuTTY is geared towards giving answers to all those questions.

One of the primary reasons behind this tutorial is to ensure that those who want to transition from shared hosting to cloud hosting can achieve their goal with ease.

Therefore, I will not make things overly complicated. I will not delve deep into technical aspects. I will keep those things for some other day. What I will do is that I will assume that you are John Snow and you know nothing!

So, I will suggest that you keep calm and read all the way to the end of this tutorial. It will give you step-by-step guides and, finally, some basic understanding of SSH Keys and why they are important.

Here is what you will find in this blurb:

  • Installing PuTTY.
  • Creating SSH Key Pair with PuTTY.
  • What is SSH Key?
  • How to use SSH Key Pair to connect to a server remotely?

Let’s begin…

Installing PuTTY

What is PuTTY? If you know nothing about networking, telling you about Telnet, raw socket connection, rlogin, etc. will not make sense. You won’t understand a damn thing.

All you need to know for now that it is an emulator. It emulates a terminal (something similar to cmd in Windows and Terminal on Linux). It is an application that helps network file transfer.

You can use this application for creating an SSH Key Pair.

PuTTY has two components. One is the PuTTY Key Generator (aka PuTTYgen), and the other one is PuTTY, which allows you to connect to a remote server using an SSH Key Pair.

To create a pair of SSH keys on the Windows operating system, you will need to install both the components.

To install PuTTY on Windows, head over to the PuTTY website, and download the MSI file. Download the appropriate version.

Once the MSI file is downloaded, double-click on it to install the application on your computer.

Complete all the steps in the installation wizard to successfully install the application.

Creating SSH Key Pair with PuTTY

Once you have installed the application, head over to the Windows search bar (if you are on Windows 10) and type puttygen and click on the first option that you see in the search. This is what it will look like:

You don’t need to run PuTTYgen as an administrator.

Once you open PuTTYgen, you will see this window:

At the bottom of this window, you will see the Parameters. This is where you can select the type of key you want to generate. We will need the RSA key type, and that is the option selected by default. You will also see the number of bits that will be present in the key that will be generated. The default value is 2048.

There is no need to change anything. The default settings are perfect.

Now click on the Generate button that you see in the PuTTYgen window. Once you do that, this is what you will see:

You will not see any key. You have to move your mouse pointer randomly in the blank space to create the key. This is what I mean:

Once you randomly move your mouse pointer, a key will be generated. This is what it will look like:

The random string of characters that you see on the top text field is the SSH Public Key. You need to copy the entire string. Save the whole string in a text file.

You will see the option of adding Key passphrase. It is not necessary to add a passphrase, but it is always a good security practice to add one.

What security?

Well, the SSH Key Pair consists of a Public Key and a Private Key. The Private Key is meant for you, and it should be a secret. If someone gets access to your Private Key, he or she can use it to gain access to the remote server.

If you add a passphrase, even if someone gets your Private Key, the person cannot use it without the passphrase.

So, I will strongly suggest that you add the passphrase before you save the Private Key. Once you add the passphrase, this is what you will see:

Ensure that you are using a very strong passphrase that you can remember, but no one else manages to crack it easily.

I will suggest that you use a combination of letters (lower case and upper case), special characters, and numbers to create a passphrase.

After you have created the passphrase, you need to use the Save private key to save the private key. You can give any name to the key, and PuTTYgen will save it using .ppk extension. This is what you will see:

Take a closer look:

You can also save the Public Key, but the format in which PuTTY saves the Public Key is not at all compatible with the OpenSSH authorized_keys files that Linux servers use for SSH authorization.

That is the reason why you should save the Public Key in a notepad. However, no one is forcing you to do so.

You can definitely save the Public Key in the format that PuTTY gives. To get the Public Key in a usable format on Linux servers, you have to open the Private Key using PuTTY. It will then display the Public Key that you can copy and use directly on Linux servers.

How do you do that?

Here are the steps:

Step 1: Open PuTTYgen

Step 2: Click on the Load button.

Step 3: Navigate to the location where you saved the Private Key, select it and click the Open button.

Step 4: You will receive a prompt for the passphrase that you used while creating the Key Pair.

Step 5: Enter the passphrase and hit the OK button. PuTTYgen will then show you the Public Key. This is what you will get:

Honestly, working with PuTTY is super easy. While all these may sound and look intimidating, the truth is that it is not! It is simple. A little bit of attention and you should be able to achieve what you want.

Okay, now that you know how to work with PuTTY, let me walk you through two basic questions.

What is SSH Key?

In simple terms, an SSH Key is an access credential when you use SSH protocol. Now, what is this SSH protocol?

I will go for an overly complicated explanation, but I will not intimidate you. Think of it like this.

You want to remotely connect to a server from your laptop. You need an internet connection. Unfortunately, the internet connection is not very secure. No internet connection in this world is secure.

There are hackers who will be snooping around and eavesdropping to find your login credentials. It is really not difficult for those people.

Instead of directly connecting to the server, you create an encrypted channel through which you will communicate with the server. No hacker can get into this encrypted channel unless they have access to the Private Key from the SSH Key Pair.

How to Use SSH Key Pair to Connect to a Server Remotely?

So, how the SSH Key Pairs work?

Here is how it works:

You first create an SSH Key Pair. You store the public key on the server (check my UpCloud hosting review to learn about that). Now, when you use a terminal or a terminal emulator like PuTTY, the server will send the Public Key to PuTTY.

PuTTY will match that key with the Private Key you have. This will ensure that your computer is talking to the intended server and not some imposter Man-in-the-Middle server.

Here is a quick video that will show you how to talk to the intended server using PuTTY and SSH Key Pair. My voice isn’t that good, and neither am I good with English. So, pardon my smattering and my horrendous English.

Alright, now that you know how to use PuTTY and SSH Key Pair to remotely connect to a server, you can stop reading any further! Actually, there’s nothing more to read!

Scroll to Top