This post shows students and new users the steps to configure PuTTY with SSH key authentication (no passwords) with Windows 11. SSH supports various authentication methods. Public key authentication is more secure and convenient than traditional password authentication.
Our previous post showed you how to configure basic SSH key authentication with Windows 11 without additional software. However, some people prefer PuTTY as their SSH client due to its simplicity. If you want to use PuTTY to connect to an SSH server using key authentication with Windows, the steps below will show you how.
The steps below will show you how to install, generate an SSH key pair, and configure PuTTY to connect to an SSH server without a password.
On Ubuntu Linux and other Unix-like systems, generating and managing the SSH key and using key-based authentication is pretty easy and straightforward. Below is a post that shows you how to create an SSH key pair on Ubuntu Linux and use the public key to authenticate to an SSH server.
How to create an SSH key for key authentication
To get started configuring PuTTY in Windows 11 to connect to an SSH server without passwords, continue below.
How to download and install PuTTY in Windows 11
PuTTY is an SSH and telnet client originally developed for the Windows platform. It is now available on other platforms, including Linux systems.
To download and install PuTTY on Windows 11, use the link below.
Select the 64-bit X86 .M: Yes archive and save. By default, in your Downloads folder.
In the Downloads folder, double-click the installer to start the installation process.
Follow the installer wizard to complete. On the screen below, choose Add shortcut to PuTTY on the desktop, then click Install on pc.
How to generate a PuTTY SSH key pair in Windows 11
Before you can generate a PuTTY key pair, you must download the PuTTYgen (key generator) application. On the same download page above, scroll down and click the puttygen.exe link to download the application.
Once the file is downloaded to your Downloads folder, find and double-click to open it.
When the application opens, click the generate and move the cursor randomly in the Putty Key Generator field window to start generating the key pair.
Once the keys are generated, add a descriptive Key comment to help you easily identify your key and Save money both keysPublic and Private keys) to a safe place.
In most cases, you will want to save your key pair in your home folder, usually in the path below.
Replace with your account name.
When saving the private key, you will be prompted for a message that you are saving the private key without passphrase. click Yes.
Both of them Public key and private key The files must be saved in the specified location.
How to copy your public key to SSH server with Windows 11
Now that you have generated your SSH key pair, you will want to copy your public key to the SSH server. On Unix-like systems, ssh-copy-id it is a tool to copy SSH keys to the server.
However, Windows does not have ssh-copy-id tool installed. To get your public SSH on the server and enable passwordless login, you will need to manually create a authorized_keys on the remote server and paste the key into it.
On the remote SSH server, in your home directory, create a .ssh folder and an authorized_keys file by running the following commands.
cd ~/ mkdir .ssh nano ~/.ssh/authorized_keys
Then copy the public key that is displayed in the PuTTY key generator application. If you close the app, just reopen and upload the private key to display your public key.
Then paste the content into the file created on the remote SSH server after running the above commands.
Save the file and you’re done.
How to configure SSH for passwordless login
Now that you have copied your public key, the next step is to disable password authentication.
Login to the remote server with your password, then open the SSH configuration file by running the following commands.
sudo nano /etc/ssh/sshd_config
In the file, find the following lines and change the value to match them.
PasswordAuthentication no ChallengeResponseAuthentication no UsePAM no
Save the file and close.
Restart the SSH server on the remote host.
sudo systemctl restart ssh
After that, password login should be disabled.
How to configure the PuTTY client for passwordless authentication with Windows 11
Finally, open the PuTTY client on your desktop. Then go to SSH -> Authand click the Browse to find the private key file (private_key) saved earlier.
Finally, go to Session, enter the username and the IP or host name (ex. firstname.lastname@example.org), provide a name for the session, and click the Save button.
You can use the saved session to log in to a remote SSH server without a password.
You should do that!
In this tutorial we have seen how to install, generate an SSH key pair using PuTTY, and configure key-based authentication with a remote SSH server. If you find any errors above or have something to add, use the comment form below.