DEV Community

Cover image for How to Generate and Use SSH Keys In Windows
Syeda Maham Fahim
Syeda Maham Fahim

Posted on

2

How to Generate and Use SSH Keys In Windows

When working with remote servers, SSH keys are a secure and convenient way to authenticate without repeatedly entering passwords.

PuTTY

PuTTY is one of the most popular tools to generate SSH keys on Windows and connect to servers like AWS or DigitalOcean.

In this guide, I’ll walk you through the steps to install PuTTY, create SSH keys, and set up secure connections with servers. Let’s get started!


1. Installing PuTTY

  • Download PuTTY from its official website.
  • Choose the version that matches your system's configuration (32-bit or 64-bit).

PuTTY

Once downloaded, install PuTTY by following the on-screen instructions.


2. Open PuTTY

  • After installation, search for PuTTY in your system's search bar and open it.

Searchbar

This will open the main PuTTY screen where you can generate SSH keys.


3. Generate an SSH Key

  • Open PuTTYgen, a key generator tool included with PuTTY. You’ll see the following screen:

window popup

  • Click on Generate to start creating your SSH key.
  • You will be asked to move your mouse randomly over the blank space in the PuTTYgen window to generate randomness (entropy) for a secure key.

generate

After the process is complete, you’ll see your SSH key displayed in the window:

SSH key


4. Save Your SSH Keys

  • Copy the public SSH key displayed in the box. This key will be pasted into the server's SSH settings.
  • Click Save private key to store the private key securely on your computer.

Tip: The private key is critical because it can regenerate the public key whenever needed. Make sure to save it in a secure location!


5. Regenerate Public Key from Private Key

If you ever lose your public key, don’t worry! You can easily regenerate it from your saved private key.

  1. Open PuTTYgen again.
  2. Click on Load and select your saved private key file.

Generating public key from private key

Your public key will be displayed again, ready to use.


6. Connect to a Server Using Your SSH Key

Now that your SSH keys are ready, you can use them to connect to remote servers. Simply:

  • Copy the public key to your server's SSH settings (e.g., AWS or DigitalOcean).
  • Use the private key when logging in through PuTTY to authenticate securely.

Final Thoughts

Setting up SSH keys on Windows using PuTTY is straightforward and ensures secure connections to remote servers. Remember these key points:

  • Save your private key securely.
  • Use your public key to set up server authentication.

Stay Connected - @syedamahamfahim 🐬


Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay