If you are in the field of programming or managing large websites, this article is for you. In this tutorial, we will check how to create an SSH key in Windows 10 and 11 using three methods.
An SSH key is a pair of cryptographic keys that are used for secure authentication between two computers. When you connect to a remote server using SSH, the server authenticates you using your public key. Your private key is kept on your local computer and is used to decrypt messages from the server. SSH keys are more secure than passwords because they cannot be easily guessed or cracked.
To create an SSH key in Windows 10/11, follow these steps:
Open the Command Prompt by typing “cmd” in the search bar and selecting “Command Prompt” from the results.
Type the following command to generate a new SSH key pair:
You will be prompted to enter a file name for your key pair. The default file name is id_rsa.
Press Enter to accept the default file name or enter a different name for your key pair.
You will be prompted to enter a passphrase for your private key. This passphrase is used to encrypt your private key and should be kept secret. Press Enter if you don’t want to use a passphrase.
Your SSH key pair will be generated and saved to the .ssh directory in your home directory.
To view your public key, type the following command:
This will display your public key in the Command Prompt.
Congratulations! You’ve successfully generated an SSH key pair in Windows 10/11.
Now that you’ve generated your SSH key pair, you can use it to connect to remote servers. To do this, you’ll need to copy your public key to the remote server.
Open the Command Prompt and type the following command:
Replace “user” with your username on the remote server and “remote-server” with the hostname or IP address of the remote server.
You will be prompted to enter your password for the remote server. This is the password you use to log in to the remote server.
Your public key will be copied to the remote server and added to the authorized_keys file in the .ssh directory of your remote user’s home directory.
To connect to the remote server using your SSH key, type the following command:
You will be prompted to enter the passphrase for your private key if you set one.
If you are dealing with Linux, this method is better for you. This method is similar to creating an SSH key in Windows cmd.
First, run Windows Terminal or the command line interface of the Linux distribution you have installed.
To create an SSH key, you must use the same command as before, but enter the desired algorithm exactly according to the example below:
ssh-keygen -t rsa -b 4096
To generate a key with the ed25519 algorithm for GitHub, run the following command:
ssh-keygen -t ed25519 -C [email protected]
To create different keys, enter the name of the relevant site at the end of the key name.
The last method to create an SSH key in Windows 10 or Windows 11 environment is to use PuTTY software, which is designed to communicate with servers in a Windows environment and is relatively old. PuTTY comes with a number of helper programs, one of which is PuTTY Key Generator, which is used to generate keys. here Download Putty
After installing PuTTY, search for “puttygen” in the start menu and click on PuTTYgen.also, you can read “How to Connect to Linux Server From Windows Using SSH/Putty?”
After running PuTTYgen, select the desired key type in the lower part of the window. As an example, you can choose the RSA algorithm and type the number 4096 in the Number of Bits In A Generated Key box.
Another option is EdDSA, and for this purpose, select the Ed25519 (255 bits) option from the menu below it.
Then click Generate to have PuTTY create the SSH key. After generating the SSH key, PuTTy will ask you to randomly move the mouse on the screen to make the generated key more random and secure.
To Save Public Key, click Save Public Key. Save this key with the pub extension and the name mentioned in that algorithm.
To use OpenSSH in PuTTy, you need to convert it. For this purpose, select Export OpenSSH Key from the Conversions menu and then save the file without extension.
SSH keys are a powerful tool for secure authentication when connecting to remote servers. By following the steps outlined in this article, you can easily create an SSH key pair in Windows 10/11 and use it to connect to remote servers. Remember to keep your private key secret and never share it with anyone. With SSH keys, you can have peace of mind knowing that your connections to remote servers are secure.