How to Generate SSH Key using PuTTYgen on Windows 10

You can generate an SSH Key on Windows 10 using the PuTTYGen utility. With an SSH keys you can connect to a remote Linux server without having to enter a password every time.

On Windows 10, First you need to generate a Private Key using the PuTTYgen, next you need to copy the public key to the remote server. After that we can log into the remote SSH server without entering a password.

You can download PuTTY and PuTTYGen for Windows 10 from www.putty.org.

Generate Private key using PuTTYgen

  1. Go to Windows Start menu and open the PuTTYgen utility.
  2. Make Sure, that SSH-2 RSA key has been selected. Type of key to generate should be RSA.
  3. Click on the Generate Button.
  4. Move your mouse over the blank area of the PuTTYgen dialog box to generate random activity and continue doing so until the progress bar is full.
  5. After Key was generated, click on the Save private key button and save SSH key to your local hard drive.
How to Generate SSH Key using PuTTYgen on Windows 10

Copy Public Key to the Remote Linux Machine

Following example illustrates the copying of the public key to remote Linux machine:

Open PuTTYgen, Go to File > Load private key and open the Private key you previously created.

Load private key puttygen

Highlight and copy the public key that was created in the text box.

Copy putty ssh Key to the Remote Linux Machine

Open the Putty terminal and login to the remote SSH server using the password.

Inside the user's home folder Create the .ssh directory if it doesn't already exist:

mkdir ~/.ssh

Create a file called authorized_keys under the ssh directory:

touch ~/.ssh/authorized_keys

Open the authorized_keys file in a text editor (nano or Vim) and copy the public key as a new line.

puttygen generate ssh key

Save the file and exit from the terminal.

Logging in to Linux using SSH Key

  1. Open PuTTY terminal.
  2. Enter the public IP address of your Linux Server.
  3. Expand SSH tab on the left menu, click Auth, and click the Browse button and open the private key.
    Click Open.

    putty ssh key
  4. You will be asked for the user name.

The user will be authenticated without the password.