A public and private key pair is required for public-key authentication in SSH. SSH key pair can be created using ssh-keygen in Linux and other Unix-based operating systems, but the tool is not available on Windows.

PuTTY Key Generator or PuTTYgen is a tool to create public and private key pairs for SSH on Windows. It is freely available and downloadable as a standalone program.

Steps to generate SSH key pair using PuTTYgen:

  1. Download PuTTY Key Generator (PuTTYgen) from the official download site and launch the program.
  2. Select the type of key to generate and the size of the key in the Parameters section and click on the Generate button.
  3. Move the mouse to provide a random seed for the key.
  4. Edit the key's comment if necessary.
  5. Enter a passphrase to protect the key if necessary.
  6. Click the Save public key button to save the public key.

    Copy the content of the displayed public key instead if you want to place it in an OpenSSH server's authorized_keys file for public key authentication method.

  7. Enter the location and file name and click on the Save button.
  8. Click on the Save private key button to save the private key.
  9. Enter the location and file name for the private key and click on the Save button.
  10. Convert the generated private key to OpenSSH format to use the key with OpenSSH client.
Discuss the article:

Comment anonymously. Login not required.

Share!