Log in with an SSH Private Key on Windows

  • Last updated on: 2016-07-05
  • Authored by: Brint Ohearn

In this example, we’re going to demonstrate how to load a private key into PuTTY. You’ll need two pieces of software to complete this task:

  1. PuTTY - Client to for managing SSH sessions
  2. PuTTYgen - Tool for managing and creating SSH key pairs

Both tools can be downloaded here:

http://www.chiark.greenend.org.uk/\~sgtatham/putty/download.html.

Note: These instructions apply to the Windows operating system. For information about using SSH private keys on Linux and OS X operating systems, see Logging in with a SSH Private Key on Linux and OS X.

Load a private key in PuTTY Key Generator

As a part of a Rackspace Deployment, you may be provided a SSH Private Key to be used for authentication against your newly deployed Linux servers. The first thing to do is save this private key into a file. Your SSH key should look similar to the following key:

You will need everything you see in the example above to be included in your key file.

  1. Launch PuTTY Key Generator.

  2. In the Actions section, click Load to load an existing private key file, and change the file type to search for to All Files.

  3. Select the key that you saved to a text file earlier and click Open.

    A confirmation is displayed after PuTTYgen successfully imports the private key. Click OK to dismiss the message.

  4. Enter a unique key passphrase in the Key passphrase and Confirm passphrase fields. You will be prompted for that passphrase whenever you log in to a server with this key.

We strongly suggest keeping the default settings as they are, so when you’re prompted to “Enter a file in which to save the key”, just press Enter to continue.

Log in to PuTTY with the private key

  1. Set up your session in PuTTy.

    You can name the session anything you like. In this example, we are naming the session based on the IP of the server we are connecting to, and click Save.

  1. Click Connection > Data in the left-hand navigation pane and set the Auto-login username to root.

  2. Click Connection > SSH > Auth in the left-hand navigation pane and configure the private key to use by clicking Browse under Private key file for authentication.

  3. Navigate to the location where you saved your private key earlier, select the file, and click Open.

The private key path is now displayed in the Private key file for authentication field.

  1. Click Session in the left-hand navigation pane and click Save in the Load, save or delete a stored session section.

  2. Click Open to begin your session with the server.

    If you saved your key with a passphrase, you will be prompted to enter that passphrase. An alert displays that the server’s host is not cached. Click Yes to continue the connection.

You are now logged in to your server.

Continue the conversation in the Rackspace Community.