How to Generate SSH Key in Windows 11
As a developer or a natural geek, your life includes a lot of remote server access, be it a VPS configuration, a web server login, a remote Nextcloud instance, GitHub access and more, you will need SSH keys for most of these logins.
in this tutorial, we will show you the various methods and techniques you can use to quickly generate SSH keys on your Windows 11 machine.
Method 1 - Using the Windows Command Prompt
The best and most easiest method of generating SSH keys on your Windows 11 machine is using the Command Prompt, now known as Windows Terminal.
By default Windows 11 comes bundled with the OpenSSH tools which will allow you to generate SSH key pairs in a matter of seconds.
Press the shortcut Win + X
to open the Windows context menu. Select Windows Terminal to open the Windows Command Prompt.
From the Windows terminal, run the command ssh-keygen
and press Enter. This command will automatically generate the SSH key pairs.
bash ssh-keygen
Output:
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\csalem/.ssh/id_rsa):
Created directory 'C:\\Users\\csalem/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\csalem/.ssh/id_rsa
Your public key has been saved in C:\Users\csalem/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:Rz+wNvwsJh5Fc9yEuAbyBRuVED0FeIPMp72GlDoVzWU csalem@CAPTAINSALEAC4C
The key's randomart image is:
+---[RSA 3072]----+
| o=@o*E.. |
| . Bo%o.o |
| o.X=+o . |
| *++* |
| +SoB.o |
| o .+o+ . |
| .o.o o |
| . + . |
| . |
+----[SHA256]-----+
NOTE: Once you run the ssh-keygen command, you may be prompted for various options such as the location to store the keys, setting up a passphrase for your keys, etc.
You can press ENTER on all the prompts to accept the defaults as shown in the example output above.
Once generated, you can access your ssh keys in the .ssh
folder in your home directory.
Method 2 - Generate SSH Key with PuTTY
PuTTY is a popular open-source terminal emulation utility that is commonly used to access and manage remote systems, especially on the Windows platform.
It provides a way to establish secure SSH (Secure Shell), Telnet, and serial connections to remote servers and devices, allowing you to interact with these systems from their local computer.
We can use the provided utilities in PuTTY ecosystem to generate an SSH key pair.
NOTE: We are assuming that you have PuTTY and associated tools installed on your Windows 11 machine. if not, you can check out our tutorial below to learn more”
https://geeekbits.io/how-to-install-putty-on-windows-11
Press the Win + S
key to open the Windows 11 search utility. Here, search for puttygen
as shown:
Once launched, PuTTY will allow you to choose the various parameters for your SSH key pair such as the type of algorithm, number of bits, etc.
For simplicity, you can accept the default values and click generate. PuTTY will tell you to move your mouse along to increase the randomization of your bit generation.
Once completed, click on the Save Public Key option to save your publick key
Choose a location to save the key and provide the name for your key.
To export the private key, select the Conversation option on the main menu.
Select Export OpenSSH key.
This will prompt you whether you wish to save the key without a passpharse. Click yes to accept the defaults.
Choose a location to save the key (usually the same folder as the public key) and provide a name for your key.
Conclusion
And there you have it. A simple and intuitive methods of generating SSH key pairs on Windows 11 machines using Terminal or Graphical interface with PuTTY.