---
title: "Generate SSH Keys on Windows 10\n    | Ubuntu"
description: Ubuntu is an open source software operating system that runs from the
  desktop, to the cloud, to all your internet connected things.
url: https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md
keywords: index, follow
---

# Generate SSH Keys on Windows 10

1. [Overview](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#1-overview)
2. [Passphrase considerations](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#2-passphrase-considerations)
3. [Key generation with Ubuntu on WSL](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#3-key-generation-with-ubuntu-on-wsl)
4. [Key generation with OpenSSH](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#4-key-generation-with-openssh)
5. [Key generation with Putty](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#5-key-generation-with-putty)
6. [Getting help](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#6-getting-help)

## 1. Overview

SSH, the secure shell, is often used to access remote Linux systems. But its authentication mechanism, where a *private local key* is paired with a *public remote key*, is used to secure all kinds of online services, from [GitHub](https://help.github.com/categories/authenticating-to-github/) and [Launchpad](https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair) to Linux running on [Microsoft’s Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ssh-from-windows) cloud.

Generating these keys from Linux is easy, and thanks to [Ubuntu on WSL](https://ubuntu.com/wsl), you can follow the same process from Windows 10. But even without Ubuntu, SSH keys can also be generated with the free and open source OpenSSH client built into Windows 10 or with PuTTY for Windows 8.1 and earlier.

Over the following few steps, we’ll guide you through the process of generating SSH keys using *Ubuntu on WSL*, *OpenSSH*, and *PuTTY*.

### Requirements

All you need is a PC running Windows and one of the following installed:

* [Ubuntu on WSL](https://ubuntu.com/wsl) for Windows 10
* The [OpenSSH client](https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse) built into Windows 10
* The `puttygen.exe` executable from [PuTTY](http://www.putty.org/) for Windows 7 or 8.1

If you don’t already have Ubuntu on WSL, take a look at our [Install Ubuntu on WSL](https://tutorials.ubuntu.com/tutorial/tutorial-ubuntu-on-windows) tutorial.

*Originally authored by Graham Morrison.*

---

[Suggest changes ›](https://discourse.ubuntu.com/t/generate-ssh-keys-on-windows-10/13957)

about
0
minutes to go

*Previous step*
[*Next step*](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#2-passphrase-considerations)

## 2. Passphrase considerations

When creating the SSH key pair, as shown in the following steps, you can choose to either lock your private key with a passphrase or use no passphrase at all.

Adding a passphrase requires the same passphrase to be entered whenever the key pair is used. Not adding a passphrase removes this requirement. For this reason, creating a key pair without a passphrase is more convenient and potentially essential for certain scripts and automation tasks. But it’s also less secure.

If a third-party gains access to a private key without a passphrase they will be able to access all connections and services using the public key.

A good compromise between convenience and security is to generate a separate key pair for each service or connection you want to use, adding a passphrase only for critical services. If you suspect a key has been compromised, simply generate a new pair for that service and remove the less secure key.

---

[Suggest changes ›](https://discourse.ubuntu.com/t/generate-ssh-keys-on-windows-10/13957)

about
6
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#1-overview)
[*Next step*](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#3-key-generation-with-ubuntu-on-wsl)

## 3. Key generation with Ubuntu on WSL

Launch **Ubuntu on WSL** from the start menu and make sure SSH is installed by entering following command at the command prompt:

```
sudo apt install openssh-client
```

The key generation process is identical to the process on a native Linux or Ubuntu installation. With SSH installed, run the SSH key generator by typing the following:

```
ssh-keygen -t rsa
```

You will be asked two questions. The first asks where to save the key, and you can press return to accept the default value. The second question asks for the passphrase. As discussed, entering a passphrase will require you to use the same passphrase whenever the key is accessed.

However, the passphrase isn’t a requirement, and pressing return (twice) will generate a key pair without one. Consequently, you won’t be asked for a passphrase when using your key.

When the process has finished, the private key and the public key can be found in the `~/.ssh` directory accessible from the Ubuntu terminal, or the following folder from Windows file manager:

```
\\wsl$\\Ubuntu\home\<username>\.ssh\
```

---

[Suggest changes ›](https://discourse.ubuntu.com/t/generate-ssh-keys-on-windows-10/13957)

about
4
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#2-passphrase-considerations)
[*Next step*](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#4-key-generation-with-openssh)

## 4. Key generation with OpenSSH

Recent versions of Windows 10 include the OpenSSH client by default, but if yours does not or you’re unsure, follow these steps:

Open Settings and then navigate to Apps > Apps and Features > Optional Features:

Scan this list to see if OpenSSH client is already installed. If not, at the top of the page select Add a feature, then, to install the OpenSSH client, locate OpenSSH Client and click Install

Once the installation completes, return to Apps > Apps and Features > Optional Features and you should see the OpenSSH component(s) listed:

You can optionally install the OpenSSH client using PowerShell, first launch ‘Windows PowerShell’ as an Administrator. To check the status of the OpenSSH client type the command:

```
Get-WindowsCapability -Online | ? Name -like 'OpenSSH.Client*'
```

This should return:

```
Name  : OpenSSH.Client~~~~0.0.1.0
State : Installed
```

If OpenSSH client is listed as “NotPresent” you can install by typing:

```
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
```

The command should return:

```
Path          :
Online        : True
RestartNeeded : False
```

Finally, to generate your keys, launch ‘Windows PowerShell’ as an Administrator, and type:

```
ssh-keygen
```

---

[Suggest changes ›](https://discourse.ubuntu.com/t/generate-ssh-keys-on-windows-10/13957)

about
0
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#3-key-generation-with-ubuntu-on-wsl)
[*Next step*](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#5-key-generation-with-putty)

## 5. Key generation with Putty

To generate a key pair with the PuTTY key generator, simply run `puttygen.exe` and click the **Generate** button in the window that appears.

You will be asked to move the mouse and press keys to improve the random number generation at the heart of SSH security. After this, the raw contents of the public key will be displayed alongside its fingerprint and a timestamp comment.

Two important fields, *Key passphrase* and *Confirm passphrase*, allow you to enter a passphrase to protect the private key.

Finally, you will need to export both the private and public keys separately:

* to export the *private key*, select **Export OpenSSH key** from the **Conversions** menu
* to export the *public key*, click **Save public key** from the main window

Public keys typically use the `.pub` suffix. By convention, the private key is usually called `id_rsa` and the public key `id_rsa.pub`, but this isn’t a requirement. It’s common to have many keys with more descriptive filenames, for instance.

---

[Suggest changes ›](https://discourse.ubuntu.com/t/generate-ssh-keys-on-windows-10/13957)

about
1
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#4-key-generation-with-openssh)
[*Next step*](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#6-getting-help)

## 6. Getting help

Congratulations! You have just generated a SSH key pair from Windows 10. You can now add the *public* key to those services you wish to authenticate.

If you need more details on using SSH keys, take a look at the [Ubuntu community documentation](https://help.ubuntu.com/community/SSH/OpenSSH/Keys), and if you get stuck, help is always at hand:

* [Ask Ubuntu](https://askubuntu.com/)
* [Ubuntu Forums](https://ubuntuforums.org/)
* [IRC-based support](https://wiki.ubuntu.com/IRC/ChannelList)

Was this tutorial useful?

---

[Suggest changes ›](https://discourse.ubuntu.com/t/generate-ssh-keys-on-windows-10/13957)

about
0
minutes to go

[*Previous step*](https://ubuntu.com/tutorials/ssh-keygen-on-windows?format=md#5-key-generation-with-putty)

*Next step*
