Extremely Serious

Category: Putty

Using Putty SSH Key Pair

  1. Login to your account on the remote server.
  2. Create a file ~/.ssh/authorized_keys file and placed in the putty public key with the following format:
ssh-rsa <PUBLIC_KEY> <KEY_COMMENT>

Note: If you don’t have a public key generated you can follow the procedure from Generating Putty SSH Key Pair.

If the file already exists then append the public key on a new line with the same format specified earlier.

  1. If necessary update the permission of the authorized_keys file with the following command:
chmod 600 ~/.ssh/authorized_keys
  1. If necessary update the permission of the .ssh directory with the following command:
chmod 700 ~/.ssh
  1. Setup the Pageant (see Using Pageant to hold the Putty Private Key) to hold the private key (and passphrase).
  2. Run the Putty application.
  3. Fill-up Host Name (or IP Address) field with the following format:
<USERNAME>@<HOST_NAME_OR_IP_ADDRESS>

Where fields are defined as follows:

<USERNAME> is the account name used on step 1.

<HOST_NAME_OR_IP_ADDRESS> is the remote server used on step 1.

Example

user@someserver.com

user@192.168.1.200

  1. Click the Open button and expect to be connected to the remote server without it asking you to provide your password (or even your passphrase).

Using Pageant to hold the Putty Private Key

  1. Run the Pageant daemon that will listen to a putty SSH connection.
  2. Right click the Pageant icon from the taskbar that can be identified like the following:
  3. Select Add Key.
  4. Browse and select the target private key (i.e. ppk file).
    Note: If you don’t have a private key generated you can follow the procedure from Generating Putty SSH Key Pair.
  5. Supply the passphrase of the key if required.

Passing the Private Key upon running the Pageant Daemon

Every time at a pageant daemon was started the private key must be added. To simplify this, we can add the private key as a parameter on the target field of the shortcut of the pageant daemon like the following:

"<PAGEANT_EXECUTABLE>" "<PRIVATE_KEY>"

Example

Where the fields are defined as:

<PAGEANT_EXECUTABLE> is "C:\putty\bin\pageant.exe"<PRIVATE_KEY> is "C:\private-key.ppk"

Note: If the key has a passphrase it must be provided every time.

Generating Putty SSH Key Pair

  1. Run the Puttygen (i.e. Putty Key Generator).
  1. Click the Generate button.
  2. Move the mouse cursor on the blank area provided by the generator.
  3. Update the Key comment field if desired.
  4. Provide an identical passphrase to the following fields if desired:
    • Key passphrase
    • Confirm passphrase
  1. Click Save private key button.
  1. Click Save public key if desired.

The content of public key file is the one to be copied on the server with the following format:

ssh-rsa <CONTINUOUS_PUBLIC_KEY> <KEY_COMMENT>

And the file normally have the following format:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: <KEY_COMMENT>
<DELIMITED_PUBLIC_KEY>
---- END SSH2 PUBLIC KEY ----

You are reading it right, in the file, the public key (i.e. DELIMITED_PUBLIC_KEY) is delimited by a carriage return. Thus, you need to remove it to have the CONTINUOUS_PUBLIC_KEY.