User Tools

Site Tools


Putty SSH Client

Putty is a popular open source SSH client for Windows.

Putty enhancements

Using public keys authentication with Putty

On the local machine

Open the PuttyGen (Putty Key Generator) tool to create a private/public key pair


Generate a rsa key pair


Enter a passphrase and save both the private and public key to your local disk. Copy the key from the field (“Public key for pasting into authorized_keys file”).

On the Linux SSH server

Check ssh server settings

Now, having created a key, we want to cause it to be trusted by our account on the SSH server. First, in order to allow Pubkey or Identity authentication, the SSH server must have the proper settings in its sshd_config:

  # Should we allow Identity (SSH version 1) authentication?
  RSAAuthentication no
  # Should we allow Pubkey (SSH version 2) authentication?
  PubkeyAuthentication yes
  # Where do we look for authorized public keys?
  # If it doesn't start with a slash, then it is
  # relative to the user's home directory
  AuthorizedKeysFile    .ssh/authorized_keys

The settings above are the defaults, which enable Identity/Pubkey authentication for both SSH version 1 and 2, and check for public keys in user's $HOME/.ssh/authorized_keys file.

Make sure you have appropriate entries in sshd_config (typically located in the /etc/ssh/ directory) and restart the server if necessary.

Add the copied key to the "authorized_keys" file:

Create a file with the public key just copied from PuttyGen

Create the .ssh dir if it doesn't already exist

mkdir .ssh
chmod 700 .ssh
cd .ssh

Concatenate the RSA Pubkey we just created to the authorized_keys file. (This will create if it doesn't already exist.)

cat ../root2_793 >> authorized_keys

Let's check out the file

cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAukGuAaWB5eQ9FcRP9lt0fh22UviDJsrwmwU
wC0gN+Eos6Dqc34pQGyFm/WpkTilovNNIHQBEpnpXbSzc8hk7BL5qgGw2hvNpYGaM= root2_793

Make sure permissions are paranoid.

chmod 600 authorized_keys

Excellent, let's log out.


Again on the local machine

Configure Putty and login

Choose your existing Session from Putty and press “Load”. Under “Connection/SSH/Auth” select your private key (generated before by PuttyGen)

Enter the username you wan't to use (optional). You'll find this setting under “Connection/Data”

Yor now ready to login! :-) Just enter your passphrase when you are prompted to.

Import/Export Putty settings

Putty stores its setting in the windows registry and not in a file so it can be hard to share the settings between multiple machines. This guide shows you how to export and import the Putty settings from the registry.

:!: Be careful about what you do in your registry, you should be really sure of…

Export settings

  1. Open the Registry Editor: Start ⇒ Run… ⇒ RegEdt32
  2. Locate the Putty Keys under HKEY_CURRENT_USER\Software\SimonTatham (Simon Tatham is the initial developer of Putty)
  3. Export the “SimonTatham” key (right click on the folder ⇒ “Export”)
    Putty registry export
  4. Save the file on your computer (a.e. “putty.reg”)

Import settings

  1. Copy the exported *.reg file to the computer where you want to import.
  2. Right click on the *.reg file and choose “Merge”
  3. Windows asks you if you are shure you want to import the settings: Click on “Yes”
/srv/ · Last modified: 2009/08/15 19:28 (external edit)