Using Cygwin SSH with Putty Pageant

On windows I mostly use Putty as my SSH client. But in some cases for example when I use unison or rsync I use the ssh client from cygwin.

Following good practice I use public key authentication and Putty's Pageant to manage my password protected keys. This works great with Putty and Plink. I thought this would be great if I could use the same agent for cygwin too. As often the solution already existed in the form of ssh-pageant.

Here is a small tutorial how to set it up:

  1. Download the prebuilt version of ssh-pageant from github (direct link).
  2. Upack it and copy the ssh-pageant.exe to your cygwin's /usr/local/bin directory
  3. You need to edit your .bash_profile file in order to start the ssh-pageant on opening a shell
    The method I use is different form the one described in ssh-pageant's readme as it only starts one instance of ssh-pageant and reuses this in subsequent sessions. It is based on the Github Help about ssh keys.

Update: In never versions the --reuse
makes things a lot easier. (Thanks sun for pointing this out)

Add this at the end of your .bashrc

See https://github.com/cuviper/ssh-pageant/pull/19

Now you should be able to login using cygwin's ssh.exe with the same comfort of putty.

14 thoughts on “Using Cygwin SSH with Putty Pageant”

  1. Thanks for the info. One thing to note – the shell redirect (>) characters are showing up as the escape sequences ‘>’

  2. Hi All,

    I’m a little lose here, I’ve performed all the steps but I’m not sure how to add my private key, or how to use the correct way this to can ssh to other host from my cygwin.

    Is there any way to help me on this?.

    Regards in advance.

    FEsparza

  3. Thanks! I had a problem with ssh-pageant crashing when I tried to use ssh. (This wasn’t immediately obvious – unless you run it in debug mode, you’ll only notice it if you’re watching to see when the ssh-pageant.exe process stops.) I was using Pageant 0.60. I upgraded to Pageant 0.63 and it all seems to work now.

Leave a Reply

Your email address will not be published.