How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (2024)

Introduction

SSH stands for Secure Shell and is a method used to establish a secure connection between two computers.

SSH works by authenticating based on a key pair, with a private key being on a remote server and the corresponding public key on a local machine. When the keys match, access is granted to the remote user.

This guide will show you how to generate an SSH key pair in Windows 10 using OpenSSH or PuTTY.

How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (1)

Prerequisites

  • A system running Windows 10
  • A user account with administrative privileges
  • Access to the command prompt
  • A web browser (optional, to download PuTTY)

Generate an SSH key in Windows 10 with OpenSSH Client

Step 1: Verify if OpenSSH Client is Installed

First, check to see if you have the OpenSSH client installed:

1. Open the Settings panel, then click Apps.

2. Under the Apps and Featuresheading, clickOptional Features.

How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (2)

3. Scroll down the list to see if OpenSSH Client is listed.

  • If it’s not, click the plus-sign next toAdd a feature.
  • Scroll through the list to find and select OpenSSH Client.
  • Finally, click Install.
How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (3)

Step 2: Open Command Prompt

1. Press the Windows key.

2. Type cmd.

3. Under Best Match, right-clickCommand Prompt.

4. Click Run as Administrator.

How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (4)

5. If prompted, click Yes in the Do you want to allow this app to make changes to your device? pop-up.

Step 3: Use OpenSSH to Generate an SSH Key Pair

1. In the command prompt, type the following:

ssh-keygen
How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (5)

2. By default, the system will save the keys to C:\Users\your_username/.ssh/id_rsa. You can use the default name, or you can choose more descriptive names. This can help distinguish between keys, if you are using multiple key pairs. To stick to the default option, press Enter.

Note: If a file with the same name already exists, you will be asked whether you want to overwrite the file.

3. You’ll be asked to enter a passphrase. Hit Enterto skip this step.

4. The system will generate the key pair, and display the key fingerprintand arandomart image.

5. Open your file browser.

6. Navigate to C:\Users\your_username/.ssh.

7. You should see two files. The identification is saved in the id_rsa file andthe public key is labeled id_rsa.pub. This is your SSH key pair.

How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (6)

Note: Normally, the public key is identified with the .pub extension. You can use Notepad to see the contents of both the private and public key.

Generate SSH Keys Using PuTTY

Before OpenSSH was included with Windows, the PuTTY tool was the gold standard for generating SSH keys.

Step 1: Install PuTTY

1. Browse to the developer’s page, and download the installer for PuTTY:

2. Double-click the downloaded file and follow the installation wizard to finish the installation.

  • On the initial dialog of the installation wizard, click Next.
  • Select the destination folder. Use the default installation configuration unless you have a specific need to change it. Click Next to move on to the next screen.
How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (7)
  • Select PuTTY product features to be installed. Stick to the defaults if you do not have any specific needs. Click Next to move on to the next screen.
How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (8)
  • Once the process completes, click Finish to exit the installation wizard.

Step 2: Run the PuTTY SSH Key Generator

1. Press the Windows key.

2. Type puttygen.

3. Under Best Match, right-click PuTTYgen.

4. Click Run as administrator.

5. If prompted, click Yes on the Do you want to allow this app to make changes to your device? pop-up.

Step 3: Use PuTTY to Create a Pair of SSH Keys

The process outlined below will generate RSA keys, a classic and widely-used type of encryption algorithm. The PuTTY keygen tool offers several other algorithms – DSA, ECDSA, Ed25519, and SSH-1 (RSA).

If you require a different encryption algorithm, select the desired option under the Parameters heading before generating the key pair.

1. In the PuTTY Key Generator window, click Generate.

2. Move the cursor around in the gray box to fill up the green bar.

How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (9)

3. Save the public key:

  • Click the button labeledSave public key.
  • Choose a location to save the key.
  • Give the key a name (e.g., putty_key.pub)
How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (10)

4. Save the private key:

  • Click theConversions menu at the top.
  • ClickExport OpenSSH key.
  • You’ll be asked if you want to save a key without a passphrase. Click Yes.
  • Choose a location to save the key (usually the same folder as the public key).
  • Give the key a name (e.g., putty_key).

Using Your SSH Keys

To use your SSH keys, copy yourpublic SSH key to the system you want to connect to. Use yourprivate SSH key on your own system. Your private key will match up with the public key, and grant access.

For further details and troubleshooting, see our guide on paswordless SSH login using SSH keys.

Conclusion

This article has provided two methods of generating SSH key pairs on a Windows 10 system. Use the SSH keys to connect to a remote system without the use of passwords.

How to Generate SSH Key in Windows 10 {OpenSSH or PuTTY} (2024)
Top Articles
Latest Posts
Article information

Author: Terrell Hackett

Last Updated:

Views: 6126

Rating: 4.1 / 5 (72 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Terrell Hackett

Birthday: 1992-03-17

Address: Suite 453 459 Gibson Squares, East Adriane, AK 71925-5692

Phone: +21811810803470

Job: Chief Representative

Hobby: Board games, Rock climbing, Ghost hunting, Origami, Kabaddi, Mushroom hunting, Gaming

Introduction: My name is Terrell Hackett, I am a gleaming, brainy, courageous, helpful, healthy, cooperative, graceful person who loves writing and wants to share my knowledge and understanding with you.