This post shows students and new users the steps to install and configure SSH with passwordless or passwordless keyed login. SSH supports various authentication methods. Public key authentication is more secure and convenient than traditional password authentication.

If you want to remotely connect to an SSH server using key authentication or use GitHub to manage your code, you will need an SSH key pair.

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

When using a Windows machine, the steps above may be a little different. Windows 11 comes with a built-in OpenSSH package and commands that can be used to generate and manage keys from the command prompt, Windows terminal, or PowerShell.

If you are going to use the command line, you should definitely use the Windows Terminal which is installed by default in Windows 11. The Windows Terminal provides a better experience and features, and you can run the Command Prompt, PowerShell, and the Windows Subsystem. Windows for Linux all in one window.

How to create SSH keys in Windows 11

As mentioned above, you can create or generate SSH keys in Windows 11. If you want to use SSH key authentication or use SSH key-based authentication, you will need to create an SSH key pair.

The steps below show you how to do it in Windows 11

In Windows, to generate an SSH key, just run the following commands and press Enter.


The above command will automatically create and generate a 2048 bit RSA key.

GitHub recommends generating an SSH key with Ed25519 algorithm.

ssh-keygen -t ed25519 -C ""

When you run the above commands, you will be prompted for the following lines asking to enter a location to save the file.

When prompted «Enter a file in which to save the key, »Press Get into to accept the default location of the file.

Generating public/private ed25519 key pair.
Enter file in which to save the key (C:UsersRichard/.ssh/id_ed25519):

If you use the default values, it will save your keys in C: User .ssh

Next, you will be asked to enter a passphrase. Usually you leave this empty and hit Enter. However, you can protect your SSH key by entering a passphrase so that you will be prompted for the passphrase each time you want to use the key to authenticate.

Created directory 'C:UsersRichard/.ssh'.
Enter passphrase (empty for no passphrase):

After that, you should see a screen similar to the one below. Your SSH key pair should be created and ready to use.

Generating public/private ed25519 key pair.
Enter file in which to save the key (C:UsersRichard/.ssh/id_ed25519):
Created directory 'C:UsersRichard/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:UsersRichard/.ssh/id_ed25519.
Your public key has been saved in C:UsersRichard/.ssh/
The key fingerprint is:
The key's randomart image is:
+--[ED25519 256]--+
|                 |
|                 |
|            o .  |
|         . + o   |
| o +.   S = o o  |
|o *.o+   + + + o |
|*..o..= . + o . .|
|B.o+...=.+ + o   |
| =+oo o+++= E    |
Windows 11 ssh powershell key generation

After the key generation process is complete, you should be able to access the key pair in the location below.


Replacement with the name of your Windows account.

windows 11 ssh key 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 may need to use PowerShell to do the same in Windows 11.

To copy your SSH key to the server, open Windows Terminal, then copy paste the line below and then press Get into.

type $ | ssh {IP-ADDRESS} "cat >> .ssh/authorized_keys"

Replace {IP ADRESS} with the IP address of the server.

If you don’t already have a ~ / .ssh / authorized_keys at the destination location, run the following Linux commands to create one. Run the above command again to copy your key to the server.

touch ~/.ssh/authorized_keys

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.

Then just type by typing below command to login without password prompt.

ssh username@server_ip_address

You should do that!


In this tutorial we have seen how to generate an SSH key in Windows 11 and then use the key to authenticate to an SSH server. If you find any errors above or have something to add, use the comment form below.

Write A Comment