How To Use Pageant to Streamline SSH Key Authentication with PuTTY | DigitalOcean (2024)

Introduction

You have seen in previous tutorials how to use PuTTY to connect to your VPS securely and how to create SSH keys with PuTTYgen.

You might have more than one SSH key for a single cloud server, or simply more than one cloud server or Droplet that requires SSH keys to log into. This can make you feel overwhelmed with having to manage, sort out, and link all those keys to their respective servers. That’s why Pageant exists.

Pageant is a PuTTY authentication agent. It holds your private keys in memory so that you can use them whenever you are connecting to a server. It eliminates the need to:

  • Explicitly specify the relevant key to each Linux user account, if you use more than one account to log into a server
  • Type a key’s passphrase each time you log into your user account; and your keys should be passphrase protected since having an unprotected key is as good as hiding your password under your keyboard!

Prerequisites

Make sure you have these prerequisites.

  • Pageant is installed together with the PuTTY suite; if you don’t have it installed, you can download it here
  • You should already have at least one SSH key saved on your local computer

Step 1 — Adding Keys to Pageant

Start Pageant from the PuTTY folder: Start-Menu > All Programs > PuTTY > Pageant

How To Use Pageant to Streamline SSH Key Authentication with PuTTY | DigitalOcean (1)

Pageant starts by default minimized in the system tray. To begin adding your SSH keys, you should right click on its icon and then the following context menu will show up:

How To Use Pageant to Streamline SSH Key Authentication with PuTTY | DigitalOcean (2)

Clicking on Add Key from the menu or View Keys to open up the Pageant Key List window. Here you can view, add, and remove keys:

How To Use Pageant to Streamline SSH Key Authentication with PuTTY | DigitalOcean (3)

Tip: You can access the Pageant Key List window directly by double-clicking its icon in the system tray.

Click the Add Key button. This will open the file explorer, where you can choose one or more keys at a time to load. You should select files with the .ppk extension:

How To Use Pageant to Streamline SSH Key Authentication with PuTTY | DigitalOcean (4)

Click the Open button to load the keys with Pageant.

If a key is passphrase-protected, you will be prompted to enter the passphrase only once before it can be added to the Pageant Key List:

How To Use Pageant to Streamline SSH Key Authentication with PuTTY | DigitalOcean (5)

After successfully adding a key, you can now see it listed:

How To Use Pageant to Streamline SSH Key Authentication with PuTTY | DigitalOcean (6)

Step 2 — Connecting to the Server(s)

Now these keys will be available while connecting to any server during your PuTTY sessions. You don’t have to take any extra steps in PuTTY. Just enter your hostname or IP address, and SSH user. PuTTY will automatically try to authenticate using any keys currently loaded in Pageant.

Step 3 (Optional) — Removing Keys from Pageant

If you want to remove a key from Pageant, select that key from the Pageant Key List window and press the Remove Key button. You can also remove multiple keys together by selecting them with CTRL or SHIFT.

Use these tips to automate your authenticated connections with Pageant.

Loading Keys Automatically on Pageant Startup

You can make Pageant automatically load one or more private keys when it starts up, instead of adding them manually every time you start up Pageant.

Go to the Pageant shortcut icon from the Windows Start Menu or your desktop.

Right click on the icon, and click on Properties.

A new window will open containing the shortcut’s properties:

How To Use Pageant to Streamline SSH Key Authentication with PuTTY | DigitalOcean (7)

From the Shortcut tab, edit the Target field. Leave the path to pageant.exe intact. After that path, add paths to your .ppk key files. These should be outside the quotation marks. Here’s an example:

"C:\Program Files\PuTTY\pageant.exe" C:\key1.ppk C:\key2.ppk

Click the Apply and then OK buttons.

Note: If the keys are encrypted, Pageant will request the passphrases on startup.

Making Pageant Run PuTTY

You can make Pageant start PuTTY or any other program once it has initialized itself and loaded any keys specified on its command line. That way you can just start Pageant instead of having to start both programs.

You can achieve this by following the same steps we used previously to add the keys automatically (see the previous section). Just add the program’s path at the end of the command in the Target field, preceded by the -c option, and contained within double quotes. Here’s an example of the full line for the Target field:

"C:\Program Files\PuTTY\pageant.exe" C:\key1.ppk C:\key2.ppk -c "C:\Program Files\PuTTY\putty.exe"

Other PuTTY Suite Products

Here are a few other helpful applications that can work with PuTTY.

  • PuTTYgen: A tool to generate and edit SSH public and private key pairs. It is part of the PuTTY suite, but it can also operate with the private key formats used by some other SSH clients like WinSCP
  • PSFTP: An interactive text-based client for the SSH-based SFTP (secure file transfer) protocol, that allows you to run an interactive file transfer session and perform many thing like listing the contents of directories, browsing around the file system, issuing multiple get and put commands, etc.
  • PSCP (PuTTY Secure Copy Client): A tool for transferring files securely between computers using an SSH connection
How To Use Pageant to Streamline SSH Key Authentication with PuTTY | DigitalOcean (2024)

FAQs

How To Use Pageant to Streamline SSH Key Authentication with PuTTY | DigitalOcean? ›

Start by opening PuTTy. Enter your hostname or IP address into the provided field and set the SSH port to 22. Next, click the Open button to open the command line window. In the command line window, type in the SSH username at the login as prompt and then press enter on your keyboard.

How to use PuTTY for SSH key based authentication? ›

The example used is for putty version 0.79.
  1. Launch PuTTY but do not connect to a remote system.
  2. In the Category window, browse to Connection>Data.
  3. Set the Auto-login username to the remote SSH username. ...
  4. Browse to Connection>SSH>Auth>Credentials. ...
  5. Test key-based authentication. ...
  6. Select Open to test the session.
Nov 23, 2023

How to generate SSH key pair with PuTTY? ›

Generating SSH key pairs locally
  1. Download PuTTYgen (available here) and run the executable.
  2. Click on the Generate button and follow on-screen instructions.
  3. Create and confirm a Key passphrase.
  4. Save public and private keys. Saving the public key with the extension . ...
  5. Upload the public key file.

How to convert SSH key to use with PuTTY? ›

Convert an SSH key to PPK format
  1. Make sure that PuTTY is installed on your device.
  2. Launch the PuTTYgen app.
  3. Click Load. ...
  4. PuTTYgen will prompt you to confirm that you want to import the key. ...
  5. Select a converted key by clicking either Save private key or Save public key.
  6. Save the key on your device for future use.

How to connect SSH using PuTTY? ›

Start by opening PuTTy. Enter your hostname or IP address into the provided field and set the SSH port to 22. Next, click the Open button to open the command line window. In the command line window, type in the SSH username at the login as prompt and then press enter on your keyboard.

How to use pageant with PuTTY? ›

Procedure
  1. Start Pageant from the PuTTY folder: Start-Menu > All Programs > PuTTY > Pageant.
  2. Find the Pageant icon in the system tray.
  3. Right-click the Pageant icon in the system tray and select View Keys. ...
  4. Click Add Key.
  5. Use the File Explorer window to select your SSH key file to load.

How to configure key-based authentication for SSH? ›

# How to Set Up SSH Key-Based Authentication for Secure, Password-Less Logins
  1. ## Step 1: Generate a New SSH Key Pair. First, you need to create a new SSH key pair on your client machine. ...
  2. ## Step 2: Configure the SSH Client. ...
  3. ## Step 3: Copy the Public Key to the Server. ...
  4. ## Step 4: Log In Without a Password.
Aug 23, 2023

How to change SSH password using PuTTY? ›

How to Change the Password in Putty:
  1. Launch Putty.
  2. Click the "SSH" radio button below the host name text box.
  3. Click the "Open" button at the bottom of the dialog box.
  4. Enter your current user name and password when prompted.
  5. Type the command "Passwd" after you've logged in.
  6. Type in your old password and press "Enter."
Jul 20, 2023

How do I add an existing SSH key to PuTTY? ›

Load your SSH private key in PuTTY Key Generator
  1. Launch PuTTY Key Generator.
  2. In the Actions section, click Load to load an existing private key. ...
  3. Select the key that you saved to a text file earlier and click Open. ...
  4. Enter a unique key passphrase in the Key passphrase field, then enter.

What format is PuTTY private key? ›

Importantly, the private key for PuTTY is only available in the merged . ppk format. In the case of a passphrase-protected . ppk, we'd get a Enter passphrase to load key prompt.

Why use PuTTY instead of SSH? ›

PuTTY is the recommended application to use for SSH connections from a Windows operating system. PuTTY allows you to access your files and email stored on the engineering servers. It also provides a UNIX environment to run programs that some courses require.

How does PuTTY SSH work? ›

PuTTY is most commonly used: as a File Transfer Protocol PuTTY can connect to a remote machine through SSH. SSH (Secure shell) is a protocol that allows a secure connection. In this way, a PC can securely send and receive data from a remote server.

How to login using SSH key? ›

This pair consists of a public key and a private key.
  1. Open a terminal on your local machine.
  2. Type the command `ssh-keygen -t rsa -b 4096` to generate a new SSH key pair.
  3. When prompted, enter a file in which to save the key. ...
  4. Enter a secure passphrase when prompted; this adds an extra layer of security.

How to use SSH private key authentication? ›

How to use a Private key for SSH authentication
  1. Step 1 : Check to see if you already have an SSH key. $ ls ~/.ssh. ...
  2. Step 2 : Create SSH key. $ ssh-keygen. ...
  3. Step 3 : Copy public key to the remote host. $ ls ~/.ssh. ...
  4. Step 4 : SSH using The Private Key. ...
  5. 10 thoughts on - How to use a Private key for SSH authentication.

How to automate SSH login using PuTTY? ›

Automate SSH logins from Windows
  1. Install PuTTY, PuTTYgen, and Pageant on the Windows system.
  2. Create a Profile With Settings for the NPS server. ...
  3. Connect to the NPS server. ...
  4. Generate a private/public key pairr using puttygen. ...
  5. Save the public key on the server. ...
  6. Attach the private key to the PuTTY profile.
Oct 17, 2019

What is PuTTY SSH authentication agent? ›

Pageant is a PuTTY authentication agent. It holds your private keys in memory so that you can use them whenever you are connecting to a server. It eliminates the need to: Explicitly specify the relevant key to each Linux user account, if you use more than one account to log into a server.

How to add PuTTY key to Authorized_keys? ›

On your computer, in the PuTTYgen utility, copy the contents of the public key (displayed in the area under "Key") onto your Clipboard. Then, on the remote system, use your favorite text editor to paste it onto a new line in your ~/.ssh/authorized_keys file, and then save and close the file.

Top Articles
Latest Posts
Article information

Author: Geoffrey Lueilwitz

Last Updated:

Views: 5832

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Geoffrey Lueilwitz

Birthday: 1997-03-23

Address: 74183 Thomas Course, Port Micheal, OK 55446-1529

Phone: +13408645881558

Job: Global Representative

Hobby: Sailing, Vehicle restoration, Rowing, Ghost hunting, Scrapbooking, Rugby, Board sports

Introduction: My name is Geoffrey Lueilwitz, I am a zealous, encouraging, sparkling, enchanting, graceful, faithful, nice person who loves writing and wants to share my knowledge and understanding with you.