Skip to main content

Generate a SSH key pair using PuTTY and PuTTYgen

To generate an SSH key pair using PuTTY and PuTTYgen, follow these steps:

  1. Download and Install PuTTY: If you don't have PuTTY installed, download and install it from the official website:

  2. Launch PuTTYgen: After installation, launch "PuTTYgen" from the Start menu or the folder where you installed PuTTY.

  3. Select the Key Type: In the PuTTYgen window, "SSH-2 RSA" is commonly used and the most supported, use ECDSA keys for improved security on more modern systems.

  4. Generate the Key Pair: Click on the "Generate" button to create a new key pair. Move your mouse randomly in the blank area below the progress bar to generate randomness for the key.

  5. Set a Key Comment (optional): You can add an optional comment to the key. This comment can help you identify the key later, especially if you have multiple keys.

  6. Choose a Key Passphrase (optional): You can add an optional passphrase to your private key for added security. If you set a passphrase, you'll need to enter it every time you use the private key for authentication. Keep the passphrase safe and secure.

  7. Save the Public and Private Keys: After the key pair is generated, click on the "Save public key" and "Save private key" buttons to save the public and private keys to your desired location. Make sure to save them with appropriate names and in secure locations.

  8. Copy Public Key to the Server (for authentication): Once you have generated the key pair, you'll need to copy the public key (usually ending with ".pub") to the server you want to log in to. The public key needs to be added to the authorized_keys file in the ~/.ssh/ directory of the server's user account you wish to access.

  9. Use the Private Key for Authentication: When using SSH, you'll need to configure your SSH client (e.g., PuTTY, OpenSSH) to use the private key for authentication when connecting to the server. In PuTTY, you can specify the private key under "Connection" -> "SSH" -> "Auth" in the "Private key file for authentication" section.

Please note that using SSH keys is considered a secure method for authentication, but it's essential to keep your private keys safe and secure. Additionally, if there are any changes or updates to the tools mentioned, please refer to the official documentation or resources for the most up-to-date instructions.