How to Generate SSH Keys in Windows 10 and Windows 11 (2024)

How to Generate SSH Keys in Windows 10 and Windows 11 (1)

To generate an SSH key on Windows 10 or Windows 11, open Command Prompt, PowerShell, or Windows Terminal and type "ssh-keygen" into the window and then enter a passphrase. The generated SSH key will be stored in the C:Users folder by default.

If part of your life includes logging in to a remote server be it for a self-hosted blog, a Nextcloud installation, or sending your latest changes to GitHub, you need SSH keys. In Windows 10 and 11 we are spoiled for choice when it comes to generating new keys.

Here’s how to create all the SSH keys you’ll ever need using three different methods. We’ll show you how to generate your initial set of keys, as well as additional ones if you want to create different keys for multiple sites.

Table of Contents

Option 1: Generate Keys in the Command Line
Option 2: Generate Keys in WSL
Option 3: Generate Keys With PuTTY

RELATED: How to Self Host Your Website Analytics With Plausible

Option 1: Generate Keys in the Command Line

Windows 10 has had a built-in OpenSSH client since the April 2018 update. Windows 11 also comes with this feature built-in.

To use it open the Windows Command Prompt by hitting the Windows key and typing “cmd”.

Tip: If you use the command line often, we’d highly recommend installing Windows Terminal from the Windows Store (installed on Windows 11 by default). It’s a tabbed program that can run the Command Prompt, PowerShell, and the Windows Subsystem for Linux all in one window. It also has fun features like setting background images.

Whether you use Command Prompt or Windows Terminal, type ssh-keygen and hit Enter. This will automatically generate the SSH keys. In our tests on Windows 11, it created a 2048-bit RSA key. If you’d like to use a different algorithm—GitHub recommends Ed25519, for example—then you’d type ssh-keygen -t ed25519.

How to Generate SSH Keys in Windows 10 and Windows 11 (2)

After you type your command hit Enter, and then you’ll be prompted to give your key a name and save it in a specific location. If you use the defaults then it will save your keys in C:\User[YourUserName].ssh —assuming the C drive is where your user account is stored.

How to Generate SSH Keys in Windows 10 and Windows 11 (3)

Next, you’ll be asked to enter a passphrase. We highly recommend you do this to keep your key secure. If you’re worried about forgetting your password check out this round-up of the best password managers on Review Geek. If you really don’t want a passphrase then just hit Enter.

How to Generate SSH Keys in Windows 10 and Windows 11 (4)

That’s it your keys are created, saved, and ready for use. You will see you have two files in your “.ssh” folder: “id_rsa” with no file extension and “id_rsa.pub.” The latter is the key you upload to servers to authenticate while the former is the private key that you don’t share with others.

How to Generate SSH Keys in Windows 10 and Windows 11 (5)

Note: If you can’t see your “.ssh” folder in File Explorer, check out our tutorial on how to show hidden files and folders in Windows.

If you wanted to create multiple keys for different sites that’s easy too. Say, for example, you wanted to use the default keys we just generated for a server you have on Digital Ocean, and you wanted to create another set of keys for GitHub. You’d follow the same process as above, but when it came time to save your key you’d just give it a different name such as “id_rsa_github”or something similar. You can do that as many times as you like. Just remember that the more keys you have, the more keys you have to manage. When you upgrade to a new PC you need to move those keys with your other files or risk losing access to your servers and accounts, at least temporarily.

RELATED: How PowerShell Differs From the Windows Command Prompt

Option 2: Generate Keys in WSL

How to Generate SSH Keys in Windows 10 and Windows 11 (6)

If you’re a WSL user, you can use a similar method with your WSL install. In fact, it’s basically the same as with the Command Prompt version. Why would you want to do this? If you primarily live in Linux for command line duties then it just makes sense to keep your keys in WSL.

Open up Windows Terminal or the built-in Ubuntu command prompt (assuming you installed Ubuntu Linux). Then it’s very similar to Windows. Unlike Windows, it’s best to specify whether you want an RSA key or something like Ed25519.

Say you wanted to create an RSA-4096 key. You’d type in the following command:

ssh-keygen -t rsa -b 4096

If you wanted Ed25519 then the recommended way is as follows:

ssh-keygen -t ed25519 -C "your@email.address"

It’s recommended to add your email address as an identifier, though you don’t have to do this on Windows since Microsoft’s version automatically uses your username and the name of your PC for this.

Again, to generate multiple keys for different sites just tag on something like “_github” to the end of the filename.

RELATED: 3 Fun Linux Tools to Run on Windows 10 With WSL

Option 3: Generate Keys With PuTTY

For years, the old school PuTTY program was a popular way to communicate with a server in Windows. If you’ve already got this program on your system it also offers a method for creating SSH keys.

PuTTY comes with a number of helper programs, one of which is called the PuTTY Key Generator. To open that either search for it by hitting the Windows Key and typing “puttygen,” or searching for it in the Start menu.

How to Generate SSH Keys in Windows 10 and Windows 11 (7)

Once it’s open, at the bottom of the window you’ll see the various types of keys to generate. If you’re not sure which to use, select “RSA” and then in the entry box that says “Number Of Bits In A Generated Key” type in “4096.” Another alternative is to select “EdDSA,” and then from the drop-down menu that appears below it make sure “Ed25519 (255 bits)” is selected.

How to Generate SSH Keys in Windows 10 and Windows 11 (8)

Now, all you have to do is click “Generate,” and PuTTY will start working. This shouldn’t take too long depending on the strength of your system, and PuTTy will ask you to move your mouse around inside the window to help create a little more randomness during key generation.

Once that’s done click “Save Public Key” to save your public key, and save it where you want with the name “id_rsa.pub” or “id_ed25519.pub” depending on whether you selected RSA or Ed25519 in the earlier step.

How to Generate SSH Keys in Windows 10 and Windows 11 (9)

Then to get your private key it takes an extra step. By default, PuTTY generates PPK keys for use with the PuTTy client. If you want OpenSSH, however, at the top of the window select Conversions > Export OpenSSH Key and then save the file as “id_rsa” or “id_ed25519” with no file ending.

How to Generate SSH Keys in Windows 10 and Windows 11 (10)

Generating SSH keys is really easy whichever method you choose. We’d recommend going with the Windows Command Prompt option unless you already have PuTTY installed, or prefer Linux and understand that system.

RELATED: The Best Ways to Secure Your SSH Server

READ NEXT

  • Sweat to Your Favorite Songs With These Bose Sport Earbuds for $20 Off
  • Samsung’s New 144Hz Gaming Monitor Is Basically a TV
  • Your Google TV Will Now Show You More Ads
  • Google Chrome Is Rolling Out New Privacy Features
  • Get Ready for Live Shows on Netflix
  • Android Screen Won’t Rotate? Here’s How to Fix It
How to Generate SSH Keys in Windows 10 and Windows 11 (2024)

FAQs

How do I find my SSH public key in Windows 11? ›

By default, SSH keys are stored in the “C:\Users\<username>\. ssh” directory. Visit the directory where you have saved the ssh key. There you will find “id_rsa” and “id_rsa.

How do I create a SSH key in Windows 10? ›

To generate an SSH key on Windows 10 or Windows 11, open Command Prompt, PowerShell, or Windows Terminal and type "ssh-keygen" into the window and then enter a passphrase. The generated SSH key will be stored in the C:Users folder by default.

How to install ssh-keygen on Windows? ›

  1. Generate an SSH key in Windows 10 with OpenSSH Client. Step 1: Verify if OpenSSH Client is Installed. Step 2: Open Command Prompt. Step 3: Use OpenSSH to Generate an SSH Key Pair.
  2. Generate SSH Keys Using PuTTY. Step 1: Install PuTTY. Step 2: Run the PuTTY SSH Key Generator. ...
  3. Using Your SSH Keys.
May 5, 2020

How do I manually generate SSH keys? ›

Generating an SSH key
  1. Enter the following command in the Terminal window. ssh-keygen -t rsa. ...
  2. Press the ENTER key to accept the default location. The ssh-keygen utility prompts you for a passphrase.
  3. Type in a passphrase. You can also hit the ENTER key to accept the default (no passphrase).
Dec 13, 2022

Does Windows 11 include SSH? ›

Access Windows SSH Client

The latest builds of Windows 10 and Windows 11 include a built-in SSH server and client that are based on OpenSSH, a connectivity tool for remote sign-in that uses the SSH protocol.

How do I know if SSH is enabled in Windows 11? ›

Open Settings, select Apps, then select Optional Features. Scan the list to see if the OpenSSH is already installed.

How do I create a SSH key in Windows 11? ›

  1. open command prompt (cmd)
  2. enter ssh-keygen and press enter.
  3. press enter to all settings. now your key is saved in c:\Users\. ssh\id_rsa. pub.
  4. Open your git client and set it to use open SSH.

How to generate SSH key using PuTTY in Windows? ›

Generating an SSH key pair using PuTTY
  1. Start PuTTYgen by clicking Start > Programs > PuTTY > PuTTYgen. ...
  2. Click SSH-2 RSA as the type of key to generate. ...
  3. Click Generate and then move the cursor around the blank area of the Key section to generate the random characters that create a unique key.

How do I generate SSH key for remote access? ›

To generate an SSH key on your Linux server run the command ssh-keygen . The command can take flags if you would like to customize the type of key that is generated as well as the signing algorithms used to generate the key. This example generates a standard 2048-bit RSA key without a passphrase.

How do I download SSH keys? ›

Downloading an SSH key
  1. Sign in to PEM Partner Repository as a Sponsor Administrator.
  2. Click Directory. ...
  3. In the Actions column, select SSH Keys from the list for the appropriate company. ...
  4. In the Content column, click the download icon against the appropriate SSH key that you want to download.

How to copy SSH key in Windows? ›

Procedure
  1. In a terminal window, enter the following command: ssh-keygen -t rsa.
  2. Follow the prompts to generate the key. You must provide a file name and a passphrase. A public and a private key are generated. ...
  3. Copy the public key to each node computer, by using the following command: ssh-copy-id username @ node_name.

Where are SSH keys stored Windows 10? ›

Your public SSH key is located by default at C:\Users\<username>\. ssh\id_rsa. pub and is perfectly safe to be shared with anyone. Your private SSH key will be located by default at C:\Users\<username>\.

Where is SSH key in Windows? ›

The public part of the key is saved in the id_rsa. pub file, while the private part is saved in the id_rsa file. Both files can be accessed from this location using Explorer: C:\Users\[your user name]\. ssh .

Do I need to generate a new SSH key for a new laptop? ›

Whoever has the key can communicate with GitHub or other sites on your behalf. So it's recommend that you avoid having to copy it ever to something else (so you don't accidentally allow others to copy it too). Instead, you should create a new key on your new machine, add that to GitHub and remove the old one.

Do I need to generate a new SSH key? ›

If you don't already have an SSH key, you must generate a new SSH key to use for authentication. If you're unsure whether you already have an SSH key, you can check for existing keys. For more information, see "Checking for existing SSH keys."

Does Windows 11 allow remote access? ›

You can enable a remote desktop to access a second computer from a remote location with Windows 11 and Windows 10. This feature uses the Remote Desktop Protocol (RDP), which you can access by using the Windows Remote Desktop app.

Does Windows 11 have product key? ›

Find your product key on a label inside the Windows 11 box. Find your product key in the confirmation email you received after buying Windows 11 or in a digital locker accessible through the retailer's website. A digital license will be given to your device for Windows 11 based on the valid product key you entered.

How do I enable port 22 on Windows 11? ›

Opening Ports in Windows Firewall
  1. From the Start menu, click Control Panel, click System and Security, and then click Windows Firewall. ...
  2. Click Advanced Settings.
  3. Click Inbound Rules.
  4. Click New Rule in the Actions window.
  5. Click Rule Type of Port.
  6. Click Next.
  7. On the Protocol and Ports page click TCP.
Nov 23, 2022

Is SSH on Windows by default? ›

SSH is considered an optional feature of Windows and may not be installed by default. To enable it, follow these steps: Open your settings. Go to Apps > Apps and Features > Manage Optional Features.

How do I enable terminal in Windows 11? ›

In Windows 11, click Search Icon located on the desktop or click the Start Menu button.
  1. Type Windows Terminal into the Search box.
  2. Click on Windows Terminal to open or choose how you want to launch.
Dec 1, 2022

How do I assign keyboard keys in Windows 11? ›

To reassign a key

Connect the keyboard that you want to configure. Select the Start button, and then select Microsoft Mouse and Keyboard Center. From the displayed list of key names, select the key that you want to reassign. In the command list of the key that you want to reassign, select a command.

How do I create a public and private SSH key in Windows? ›

Generating an SSH Key Pair on Windows Using the PuTTYgen Program
  1. Run the PuTTYgen program. ...
  2. Set the Type of key to generate option to SSH-2 RSA.
  3. In the Number of bits in a generated key box, enter 2048.
  4. Click Generate to generate a public/private key pair.

How to generate SSH key in Windows using Git Bash? ›

The process for creating an SSH key is the same between them.
  1. execute the following to begin the key creation. ssh-keygen -t rsa -b 4096 -C "your_email@example.com" ...
  2. You will then be prompted to "Enter a file in which to save the key." ...
  3. The next prompt will ask for a secure passphrase. ...
  4. Add the new SSH key to the ssh-agent.

How to generate SSH key without passphrase? ›

How to Set Up Passwordless SSH Login
  1. Before You Start: Check for Existing SSH Keys.
  2. Step 1: Generate SSH Key Pair.
  3. Step 2: Upload Public Key to Remote Server. Option 1: Upload Public Key Using the ssh-copy-id Command. ...
  4. Step 3: Log in to Server Without Password.
  5. Optional: Troubleshooting Remote Server File Permissions.
Apr 15, 2020

Which tool can be used to generate a SSH key? ›

PuTTYgen is an key generator tool for creating SSH keys for PuTTY. It is analogous to the ssh-keygen tool used in some other SSH implementations. The basic function is to create public and private key pairs.

How do I generate a SSH key for a non root user? ›

Option 1: Create a New SSH Key
  1. SSH to the instance as root.
  2. Create an SSH key for example_user. # sudo -u example_user ssh-keygen Generating public/private rsa key pair. ...
  3. Save the private key, /home/example_user/. ...
  4. Delete the private key from your instance. ...
  5. Rename the public key to authorized_keys .
Apr 6, 2021

How do I find my SSH IP address in Windows? ›

Windows 10 includes an SSH client that's installed by default. The IP address of the device you're connecting to. In Factory OS, get the IP address from the main screen of the Factory Composer app, or in the top-right corner of Factory Orchestrator.

Where are SSH keys stored? ›

On Linux systems, the default location for SSH keys is in the user's personal directory in the file ~/. ssh/known_hosts. On Windows systems, the default file location is in the user's personal directory in the file C:\Users\username\. ssh\known_hosts.

How do I create a key pair in Windows? ›

Creating the key pair

On the bottom right, click the Generate button. Follow the instructions and move your mouse in the blank area to generate random data. Click the Save public key button to save a modified version of the public key.

How do I know if SSH key is generated? ›

Checking for existing SSH keys
  1. Open Terminal .
  2. Enter ls -al ~/.ssh to see if existing SSH keys are present. $ ls -al ~/.ssh # Lists the files in your .ssh directory, if they exist.
  3. Check the directory listing to see if you already have a public SSH key. ...
  4. Either generate a new SSH key or upload an existing key.

Is SSH key same as public key? ›

The SSH key pair is used to authenticate the identity of a user or process that wants to access a remote system using the SSH protocol. The public key is used by both the user and the remote server to encrypt messages. On the remote server side, it is saved in a file that contains a list of all authorized public keys.

Can I regenerate SSH key? ›

To regenerate keys you need to delete old files and reconfigure openssh-server. It is also safe to run following commands over remote ssh based session. Your existing session shouldn't be interrupted.

How do I add a new SSH key to my computer? ›

pub to ~/. ssh directory on a new computer and SSH would work as on the first computer.
...
Copy SSH Keys to A New Computer
  1. In the old machine, take the folder ~/. ssh to an USB drive, or to any other storage you like.
  2. On the new machine, put the folder under ~ aka /home/$USER.
  3. Run ssh-add, on the new machine done.
Jun 7, 2020

Where is my SSH public key located? ›

Open Terminal . Enter ls -al ~/.ssh to see if existing SSH keys are present. Check the directory listing to see if you already have a public SSH key.

Where can I find my public SSH key? ›

Checking for existing SSH keys
  1. Open TerminalTerminalGit Bash.
  2. Enter ls -al ~/. ssh to see if existing SSH keys are present. ...
  3. Check the directory listing to see if you already have a public SSH key. ...
  4. Either generate a new SSH key or upload an existing key.

Where are SSH public keys stored Windows? ›

Your public SSH key is located by default at C:\Users\<username>\. ssh\id_rsa. pub and is perfectly safe to be shared with anyone. Your private SSH key will be located by default at C:\Users\<username>\.

Where is SSH public key stored? ›

By default, your private and public keys are saved in your ~/. ssh/id_rsa and ~/. ssh/id_rsa. pub files, respectively.

How do I generate my SSH public key? ›

Generating an SSH key
  1. Open the PuTTYgen program.
  2. For Type of key to generate, select SSH-2 RSA.
  3. Click the Generate button.
  4. Move your mouse in the area below the progress bar. ...
  5. Type a passphrase in the Key passphrase field. ...
  6. Click the Save private key button to save the private key.
Dec 13, 2022

How do I add a new SSH key? ›

First, check to see if your ~/. ssh/config file exists in the default location. $ open ~/. ssh/config > The file /Users/YOU/.
...
  1. Start the ssh-agent in the background. $ eval "$(ssh-agent -s)" > Agent pid 59566. ...
  2. Add your SSH private key to the ssh-agent. ...
  3. Add the SSH key to your account on GitHub.

How do I find my SSH public key in Windows 10? ›

The public part of the key is saved in the id_rsa. pub file, while the private part is saved in the id_rsa file. Both files can be accessed from this location using Explorer: C:\Users\[your user name]\. ssh .

How do I find my SSH private key passphrase? ›

Recovering your SSH key passphrase
  1. In Finder, search for the Keychain Access app.
  2. In Keychain Access, search for SSH.
  3. Double click on the entry for your SSH key to open a new dialog box.
  4. In the lower-left corner, select Show password.
  5. You'll be prompted for your administrative password. ...
  6. Your password will be revealed.

Top Articles
Latest Posts
Article information

Author: Melvina Ondricka

Last Updated:

Views: 5932

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Melvina Ondricka

Birthday: 2000-12-23

Address: Suite 382 139 Shaniqua Locks, Paulaborough, UT 90498

Phone: +636383657021

Job: Dynamic Government Specialist

Hobby: Kite flying, Watching movies, Knitting, Model building, Reading, Wood carving, Paintball

Introduction: My name is Melvina Ondricka, I am a helpful, fancy, friendly, innocent, outstanding, courageous, thoughtful person who loves writing and wants to share my knowledge and understanding with you.