Creating an SSH key on Windows |

Creating an SSH key on Windows

I've been through this so many times with people running Windows so that I want to put this down to paper.

Install Cygwin & its SSH Package

Install Cygwin and be sure to check for theopenssh-client package while runningsetup.exe

cygwin setup.exe

Generate the key using the Cygwin shell

You can now run standardssh commands that you see documented on the plethora of Linux and Unix websites on the internet. Right now, the command you really want to run is:

$ ssh-keygen -t rsa

I recommend entering a password so that in case someone steals your key, they still cannot use it.

This key, found in~/.ssh/ can now be added to the~/.ssh/authorized_keys file on the servers on which you want to log into.

But: Can't I just not use PuTTY to generate the keys?

PuTTY is an excellent SSH client, but I would not recommend using its key generator as I've seen so many cases where it doesn't create proper keys for using with Linux/Unix OpenSSH servers.

This has at least been my experience with at least five Windows users so I've stopped asking people to use PuTTY to create their keys. It is probably possible to create proper keys with PuTTY, but my experience is very bad with this and I'd therefore recommend using Cygwin and ssh-keygen instead.

Making use of your new key

Since you now have Cygwin andssh on your machine, you can just use the Cygwin shell and follow the standard Unix way and add the key withssh-add and usessh afterwards. If using Cygwin, I seriously recommend using itsxterm as it gives you a so much better shell than the Windows/DOS shell that cygwin standard wise is launched inside in: better fonts, better signal handling and much faster input and output buffer.

If you prefer using PuTTY, there's a walkthrough on using PuTTY and its key agent here. Rememer, you need to make a note of where the key you generated inside Cygwin is on the Windows file system, normaly, it's somewhere under c:\cygwin\...

gmail torstein.k.johansen @ gmail ~ twitter @torsteinkrause ~