An SSH key is used for authentication between the client and server that are communicating using the SSH (Secure Shell) network protocol. It allows a safe and secure channel on top of an unsafe network for communication between systems. This secure connection can be used to gain remote access to a machine on the other end. Here we will detail the steps to generate this SSH key on a Windows 11 PC.
Step 1 – Install OpenSSH Client Feature
At first, you need to check if the OpenSSH Client feature is installed on your PC or not. If it is already present then you can continue with generating the key else, you need to install it.
1. Press Windows and I keys simultaneously to open the Windows Settings page.
2. Select the Apps tab in the left pane.
3. Click on Optional Features on the right side.
4. In the search box below Installed features type OpenSSH Client to check if it is already installed.
5. If you see the feature present then continue to Step 2.
6. In case the feature is not installed, click on the View features button associated with Add an optional feature.
7. Search for OpenSSH Client in the list.
8. Check the box associated with it and click on Next.
9. Click on the Install button.
10. Once it is installed, restart your PC and move to Step 2 to generate the SSH key.
Step 2 – Create an SSH Key
1. Hit the Windows key and type cmd in the search box.
2. Right-click on Command Prompt and choose Run as administrator.
3. If prompted by User Access Control, click on Yes.
4. Execute the command below
5. On executing the above command, it will ask Enter file to save the key with a default location mentioned.
Note: The default location for saving the keys is C:\Users\<username>\.ssh\id_rsa
6. Now if you hit Enter the SSH key will be saved in the above default location. Else if you want you can change the location by typing the new path.
7. Next it gives an option to create a password (passphrase) for the SSH key created.
8. Press the Enter key if you want to proceed without creating a passphrase.
9. If you want to secure the key then type a password and confirm it by retyping it. Remember this password as this is needed while using the SSH key every time.
10. Now the key will be created and you see the fingerprint of the key and SHA256 hash value. Also, you will see the RSA algorithm that has been used.
11. You can now use your key in the path mentioned below
It will be present in the id_rsa.pub file.
We hope you are now able to generate an SSH key pair for communication between two entities over a network.
A software engineer turned into an educator with vast teaching experience in universities. Currently working towards my passion for writing.