How to Setup PuTTY SSH Key Authentication with Windows 11

doctor 4187242 640

This post shows students and new users steps to configure PuTTY with SSH Key (no passwords) authentication with Windows 11. SSH supports various authentication methods. Authenticating using public key is more secure and convenient than traditional password authentication.

Our previous post showed you how to setup SSH Key base authentication with Windows 11 without additional software. However, some people prefer to use PuTTY as their SSH client because of its simplicity. If you want to use PuTTY to connect to a SSH server using key authentication with Windows 11, then the steps below will show you how to do that.

The steps below will show you how to install, generate SSH key pair and configure PuTTY to connect to a SSH server without a password.

In Ubuntu Linux and other Unix-like systems, generating and managing SSH key and using key based authentication is pretty easy and straightforward. Below is a post that shows you how to create a SSH key pair in Ubuntu Linux and use the public key to authenticate to a SSH server.

How to create a SSH key for key authentication

To get started with configuring PuTTY in Windows 11 to connect to a SSH server without passwords, continue below.

How to download and install PuTTY on Windows 11

PuTTY is an SSH and telnet client originally developed for Windows platform. It’s now available on other platforms, including Linux systems.

To download and install PuTTY in Windows 11, use the link below.

Download PuTTY on Windows 11

Select the 64-bit x86 .msi file and save. By default, in your Downloads folder.

download putty on windows 11

In your Downloads folder, double-click the downloaded installer to initiate the install process.

install putty on windows 11

Follow the installer wizard until complete. On the screen below, choose to Add shortcut to PuTTY on the Desktop, then click Install.

install putty button windows 11

How to generate PuTTY SSH Key pair in Windows 11

Before you can generate a PuTTY key pair, you must download PuTTYgen (key generator) app. On the same download page above, scroll down the page and click the puttygen.exe link to download the app.

Download puttygen.exe

puttygen download file

Once the file is downloaded to your Downloads folder, browse and double-click to open the app.

putty key generator generate

When the app opens, click the Generate button, then move the cursor randomly on the Putty Key Generator field window to begin generating the key pair. When you stop the cursor, the process will also stop. So continue moving the cursor until the process is complete.

putty key generator move cursor

After the keys are generated, add a descriptive Key comment to help you easily identify your key and Save both keys (Public and Private keys) to a secure location.

putty save key pair

In most cases, you’ll want to save your key pair in your home folder, usually at the path below.

C:\Users\<username>\.ssh

Replace <username> with your account name.

putty saved key pair in windows

When saving the private key, you’ll be prompted with a message that you’re saving the private key without passphrase. click Yes.

putty save private with no password

Both the public_key and private_key files should be saved at the location specified.

putty key file saved

How to copy your public key to the SSH server with Windows 11

Now that you’ve generated your SSH key pair, you will want to copy your public key to the SSH server. On Unix-like systems, ssh-copy-id is a tool for copying SSH keys to the server.

However, Windows doesn’t have ssh-copy-id tool installed. To get your public SSH to the server and enable password-less login, you will have to manually create an authorized_keys file on the remote server and paste the puvblic key into it.

On the remote SSH server, in your home directory, create a .ssh folder and a authorized_keys file by running the commands below.

cd ~/
mkdir .ssh
nano ~/.ssh/authorized_keys

Then copy public key displayed in the PuTTY Key generator app. If you close the app, simply reopen and load the private key to display its public key.

copy public key ssh windows

Then paste the content into the file created on the remote SSH server after running he commands above.

ubuntu paste ssh key putty

Save the file and you’re done.

How to configure SSH for passwordless login

Now that you’ve copied over your public key, the next step is to disable password authentication.

Logon to the remote server with your password, then open SSH configuration file by running the commands below.

sudo nano /etc/ssh/sshd_config

In the file, find the lines below and change the value to match these.

PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no

Save the file and exit.

Restart SSH server on the remote host.

sudo systemctl restart ssh

After that, password login should be disabled.

How to configure PuTTY client for password less authentication with Windows 11

Finally, open PuTTY client on your Desktop. Next, go to SSH –> Auth, and click the Browse button to browse for your private key (private_key) file saved above.

putty browse private key windows 11

Finally, go to Session, type in username and host IP or name (ex. username@10.0.2.19), provide a name for the session and click the Save button.

putty create and save sessions windows 11

You’ll be able to use the saved session to login to a remote SSH server without password.

login no password windows 11

That should do it!

Conclusion:

This post showed you how to install, generate SSH key pair using PuTTY and configure a key based authentication with a remote SSH server. If you find any error above or have something to add, please use the comment form below.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.