Home > Articles > Ubuntu > Using SSH2 Keys on Windows

In Brief: Using SSH2 Keys on Windows

16 jan 2007, Simon Strandgaard

server is Ubuntu linux, client is Windows XP using Pageant

prompt> uname -a
Linux 2.6.15-23-server #1 SMP Tue May 23 15:10:35 UTC 2006 i686 GNU/Linux

CLIENT-STEP1: fetch these tools

Fetch "puttygen.exe", "putty.exe" and "pageant.exe" from PuTTY homepage

CLIENT-STEP2: generate key pair

IMPORTANT leave passphrase empty

launch "puttygen.exe" and generate a 'SSH-2 DSA' key.

make the directory "c:\Documents and Settings\User Name\sshkeys"
save the "public key" as "public"
save the "private key" as "private.ppk" select and copy the key-text to the clipboard

SERVER-STEP1: upload public key

connect from the client to the server via putty.

prompt> cd
prompt> mkdir .ssh
prompt> chmod 700 .ssh
prompt> cd .ssh
prompt> touch authorized_keys
prompt> chmod 600 authorized_keys
prompt> edit authorized_keys

now paste the key text from the clipboard
save file

prompt> exit

CLIENT-STEP3: verify login without password

open putty's configuration panel

under 'Connection -> Data', set Auto-login username to "neoneye"
under 'Connection -> SSH -> Auth', set Private key file to your "sshkeys/private.ppk" file
Save configuration

now connect to the server via putty. If everthings works then you should be logged in without being prompted for a password!

CLIENT-STEP4: configure pageant

create a shortcut in "Start Menu -> Programs -> Startup" with target:

c:\windows\pageant.exe "c:\Documents and Settings\User Name\sshkeys\private.ppk"

reboot

pageant appears in systray as a terminal with a hat.
If you choose "view keys", you should see your own key.

CLIENT-STEP5: no password

things that uses SSH should now use SSH keys.
I run Subversion and I check that I can commit without typing my password