How to Generate SSH Key using PuTTYgen on Windows 10
You can generate an SSH Key on Windows 10 using the PuTTYGen utility. With an SSH keys you can connect to a remote Linux server without having to enter a password every time.
On Windows 10, First you need to generate a Private Key using the PuTTYgen, next you need to copy the public key to the remote server. After that we can log into the remote SSH server without entering a password.
You can download PuTTY and PuTTYGen for Windows 10 from www.putty.org.
Generate Private key using PuTTYgen
- Go to Windows Start menu and open the PuTTYgen utility.
- Make Sure, that SSH-2 RSA key has been selected. Type of key to generate should be RSA.
- Click on the Generate Button.
- Move your mouse over the blank area of the PuTTYgen dialog box to generate random activity and continue doing so until the progress bar is full.
- After Key was generated, click on the Save private key button and save SSH key to your local hard drive.
Copy Public Key to the Remote Linux Machine
Following example illustrates the copying of the public key to remote Linux machine:
Open PuTTYgen, Go to File > Load private key and open the Private key you previously created.
Highlight and copy the public key that was created in the text box.
Open the Putty terminal and login to the remote SSH server using the password.
Inside the user's home folder Create the .ssh directory if it doesn't already exist:
mkdir ~/.ssh
Create a file called authorized_keys under the ssh directory:
touch ~/.ssh/authorized_keys
Open the authorized_keys file in a text editor (nano or Vim) and copy the public key as a new line.
Save the file and exit from the terminal.
Logging in to Linux using SSH Key
- Open PuTTY terminal.
- Enter the public IP address of your Linux Server.
- Expand SSH tab on the left menu, click Auth, and click the Browse button and open the private key.
Click Open. - You will be asked for the user name.
The user will be authenticated without the password.