Setting up PuTTY and OpenSSH with public/private keys
I had to follow this strange recipe to get the latest
PuTTY (0.53b) to work
with SSH 2 RSA Public/private key pairs, and a recent
OpenSSH (3.4p1):
- Get a shell on a box with OpenSSH
- Create a key pair:
`ssh-keygen -t rsa'
Remember the passphrase
- Move both generated files from the
~/.ssh directory to
your local PuTTY directory in Windows.
- Run PuTTY Key Generator (puttygen.exe) and import the key you just
generated:
Conversions > Import key
- Edit the "Key comment" so that it stands out from your other keys,
e.g. "Key-for-all-local-systems"
- Click the "Save public key" button to create a public key file.
- Click the "Save private key" button to create the private key file.
- Select the text in the Public view in the PuTTY Key Generator window, and
copy the text to the clipboard.
- Create a new file on your remote computer at
~/.ssh/authorized_keys
- Open the file and paste the clipboard in the file (Shift+Insert
usually); Now save that file.
- Make sure that you set the "Auto-login username" field for
your remote connection in the PuTTY Configuration dialog for that connection.
PuTTY will hint the SSH server that it should look
for a public key in the authorized_keys file of the user in that field.
- Start the PuTTY Agent (pageant.exe),
you will see a computer-with-a-hat icon in your system tray.
- Click on "View keys", and "Add key". Now select the private key file you generated
earlier. Enter the passphrase
- That should be it. Try it out by selecting the saved connection from PuTTY Agent.
You should be logged on to the system without providing a password.
- Obviously, this only makes sense if you now add the public key text to
the authorized_keys file on
all the remote systems you want to log on to with this pair.