Set up SSH Authentication Agent
Objectives
- Create
a batch file to automatically launch Pageant whenever you log into your
computer.
- Convert
openSSH keys into PuTTY's private key file format.
- Load
private keys into Pageant's keyring.
Prerequisites
- Access
to SSH Keys Keepass database.
- A
computer with Microsoft Windows.
- A full
installation of PuTTY (i.e. not just the putty.exe executable).
- A text
editor that can save batch files (Notepad is fine).
Instructions
- Copy J:\FullCount\Documentation\Office\Workstations\Authentication
folder and contents under C:\Users\<user>\Documents to create
template directories for the below steps.
- Confirm
that you have a full installation of PuTTY on your computer.
- A
full installation of PuTTY includes Pageant, PSFTP, PuTTY and PuTTYgen.
- By
default, the 64-bit version of these programs are installed in a folder
named C:\Program Files\PuTTY.
- If
this directory does not exist on your computer, you probably do not have
a full installation of PuTTY.
- If
you do not have a full installation of PuTTY, refer to the instructions
in Install
PuTTY SSH Client.
- Save a
copy of the encrypted SSH keys on your computer.
- Checkout
a copy of the SSH Keys KeePass database from Subversion.
- Unlock
the SSH Keys KeePass database.
- Double-click
on an entry to edit it.
- Click
on the Advanced tab.
- Under
Attachments, click on the name of the attachment (it should end in
.ppk).
- Click
on the Save button, and choose a folder on your computer to save
the SSH keys in. Make sure you put all of the SSH keys in the same
folder. Default location is
C:\Users\<user>\Documents\Authentication\ssh keys
- Repeat
the last few steps for any other SSH keys you would like to use.
**Note** This is a user-specific step - machines that are
re-purposed for new hires will need this step taken again.
- Create
a batch file to launch Pageant.
- Create
a folder on your computer to save the batch file. Our default
location is C:\Users\<user>\Documents\Authentication\Pageant.
- This
will be prepopulated with a file called Pageant.bat if you copied
contents from Step 1.
- Right
click on file and create a shortcut to be used in step 5.
- Create
a shortcut to automatically launch Pageant whenever you log into your
computer.
- Select
Windows Key + R to open Run command window. Enter shell:startup
and select OK.
- Copy
Pageant - Shortcut.bat file from step 4. to startup folder.
Rename shortcut to Pageant.bat.
**Note** This is a user-specific step - machines that are
re-purposed for new hires will need this step taken again.
- Test
your shortcut and batch file.
- Double-click
on the shortcut. Pageant should a open new password dialog box for each
SSH key listed in your batch file.
- Set up
your default profile in PuTTY.
- Start
PuTTY.
- In
the Category tree on the left, expand SSH, and then click
on Auth.
- Check
the box next to Attempt authentication with Pageant.
- Check
the box next to Allow agent forwarding.
- In
the Category tree on the left, click on Session.
- Under
Saved Sessions, click on Default Settings.
- Click
on the Save button.
- Set up
a custom protocol handler for SSH.
- This
will allow you to start PuTTY by clicking on a link in your web browser.
- Refer
to the instructions in Launch
PuTTY from Remote Connections Page.
Batch File Template
REM ---- Start of Batch File Template ----
@echo off
REM Path to pageant command.
set
pageant="%ProgramFiles%\PuTTY\pageant.exe"
REM Path to the folder that contains your SSH keys.
set
keystore="C:\Users\%USERNAME%\Documents\Authentication\SSH Keys"
REM Start pageant and load your SSH keys.
REM Empty double quotes seem to be required by the 'start'
command.
start "" %pageant%
%keystore%\production_ed25519.ppk
start "" %pageant%
%keystore%\development_ed25519.ppk
start "" %pageant% %keystore%\test_ed25519.ppk
start "" %pageant% %keystore%\remote.ppk
start "" %pageant% %keystore%\terminals.ppk
start "" %pageant%
%keystore%\terminals_ed25519.ppk
REM ---- End of Batch File Template ----
References
- PuTTY User
Manual
- Using
public keys for SSH authentication
- Using
Pageant for authentication