Use SSH Keys with putty on Windows

in #putty4 years ago

Introduction
SSH can handle authentication using a traditional username and password combination or by using public and private key pair.

The SSH key pair establishes trust between the client and the server, thereby removing the need for a password during authentication. While not required, the SSH private key can be encrypted with a passphrase for added security.

The best putty alternative For SSH Clients for Microsoft Windows does not share the same key format as the OpenSSH client. Therefore, it is necessary to create a new SSH public and private key using the PuTTYgen tool or convert an existing OpenSSH private key.

Requirements

  1. PuTTY SSH client for Microsoft Windows
  2. Remote server accessible over OpenSSH
  3. Install PuTTY And PuTTYgen

Both and PuTTYgen are required to convert OpenSSH keys and to connect to the server over SSH. These two tools can be downloaded individually or, preferably, as a Windows installer from the PuTTY Download Page.

Once the PuTTY Windows installer is downloaded, double-click the executable in the Download folder and follow the installation wizard. The default settings are suitable for most installations. Both PuTTY and PuTTYgen should now be accessible from the Windows Programs list.

Use Existing Public And Private Keys
If you have an existing OpenSSH public and private key, copy the id_rsa key to your Windows desktop. This can be done by copying and pasting the contents of the file or using an SCP client such as PSCP which is supplied with the PuTTY install or FileZilla.

Next launch PuTTYgen from the Windows Programs list.

  1. Click Conversions from the PuTTY Key Generator menu and select Import key.
  2. Navigate to the OpenSSH private key and click Open.
  3. Under Actions / Save the generated key, select Save private key.
  4. Choose an optional passphrase to protect the private key.
  5. Save the private key to the desktop as id_rsa.ppk.

Create New Public And Private Keys
Launch PuTTYgen from the Windows Programs list and proceed with the following steps.

  1. Under Parameters, increase the number of bits in a generated key: to a minimum value of 2048.
  2. Under Actions / Generate a public/private key pair, click Generate.
  3. You will be instructed to move the mouse cursor around within the PuTTY Key Generator windows as a randomizer to generate the private key.
  4. Once the key information appears, click Save the private key under Actions / Save the generated key. Save the private key to the desktop as id_rsa.ppk.
  5. The box under Key / Public key for pasting into OpenSSH authorized_keys file: contains the public key.

Connect To Server With Private Key

Now it is time to test SSH key authentication. The PuTTYgen tool can be closed and PuTTY launched again.

  1. Enter the remote server Host Name or IP address under Session.
  2. Navigate to Connection > SSH > Auth.
  3. Click Browse... under Authentication parameters / Private key file for authentication.
  4. Locate the id_rsa.ppk private key and click Open.
  5. Finally, click Open again to log into the remote server with key pair authentication.

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.029
BTC 58098.46
ETH 3134.93
USDT 1.00
SBD 2.38