Putty is an ssh client for Microsoft Windows which can automate secure logins to remote computers. This tutorial allows you to automate these logins using your public/private key pair.
Putty can be downloaded from here: http://www.chiark.greenend.org.uk/~sgtatham/putty/. Download and install the entire putty distribution.
During this procedure the following high-level steps are taken:
- First, create a public-private key pair using
- Second, create a session for logging into a particular host. This session will include the IP address, and can include the username and location of your private key
- Lastly, add your public key to the host you’ll be logging into.
Each of these steps is detailed below.
Create a private key
Follow the Putty documents for using the using
puttygen application. Create a private key with a passphrase. Choose a passphrase that is easy for you to remember, but is long, like a complete sentence, with misspellings or numbers included.
As an example only, “A p3nny sav3d is a p3nny 3arn3d”
Create a session for each host you access
- Launch the Putty configuration utility.
- In the Connection -> Data, enter the name of the user to login with
- In the Connection -> SSH -> Auth, enter the path to the private key file. This path is where the private key is stored on your PC.
- In the Session category, enter the IP Address of the host
- Last step, in the Session category, save the session using a helpful name
Create your public key on the host youâ€™ll be logging into
On a UNIX host
Where $HOME is the path to the home directory of the user you login as. Then, make a directory for ssh.
Next, launch the
puttygen application on your PC and follow the directions to load your private key.
Select and copy the public key text from the
In the active window on the host , paste into the vi editor using SHIFT-INSERT. Save and quit the editor. Then make the directory and file executable.
chmod go-w $HOME $HOME/.ssh $HOME/.ssh/authorized_keys
Using your session
- To login using the session youâ€™ve created, launch the putty application.
- Select from the Saved Settings list the session you created in step 2.3, above. Click Load.
- Click Open
- You should be prompted to enter your passphrase. Enter the passphrase. You should login successfully. Resolve any errors before continuing.
Automating passphrase Entry
Using the steps above requires you to enter your passphrase every time you login to this host. Entering the passphrase can be automated using the Pagent application included in the putty distribution.
- Launch the
- Click Add Key.
- Select the private key you created in section 2.2, above. Click Open.
- Pagent will prompt you to enter the passphrase you entered when the private key was created.
- Now follow the steps in section 3, above.
You should be logged into the host without being asked to enter your password or your passphrase. Resolve any errors before continuing.
Lastly, on windows a shortcut can be created that does this all in a single double-click.
- Find the Putty application on your PC. Right-click and select Create Shortcut.
- Right-click on the shortcut and select Properties.
- Click on the Shortcut tab of the Properties dialog box.
- In the Target box append load <session> where session is the name created in step 2.3, above.
- Double-click the shortcut to login to this host.