Can I use PLink and Pageant with Cygwin's ssh?

I'm now using msysgit because of the GUI tools, which use Putty's Pageant and PLink utilities, but I use Cygwin as a general SSH terminal. I had been using ssh-agent on Cygwin, but that means I have to enter my SSH key passphrases for both SSH key managers. Is it possible to configure all my Unix-port tools (msys, git, cygwin, Ruby Net:SSH, etc.) to use PLink/Pageant instead of ssh-agent? It seems that's the kind of thing PLink was made for, but I can't find documentation on how.


Solution 1:

I also wrote a proxy between openssh and pageant, which I call ssh-pageant. It looks like pretty much the same approach as charade, but I hadn't heard of it. Well in case you have trouble, I thought I'd throw out ssh-pageant to try instead.

Solution 2:

I came across charade a while ago, which replaces ssh-agent and proxies to Pageant. At the time I couldn't quite get it working, and haven't had the chance to play with it since, but it might be worth a try. If you have any luck please post back and let me know, it's been on my list of things to do for ages!

Solution 3:

You are looking to integrate ssh-agent and pageant so that you have only one keystore. One way you can do this is use PuTTY as your terminal, keep your keys in pageant, enable agent forwarding, run Cygwin sshd and ssh to localhost. This will give you an environment where keys are served by pageant over the ssh connection with PuTTY -- no need to run ssh-agent.

It should be possible to do the same with Plink. Just use the -A option, and use the resulting SSH_AUTH_SOCK setting in your interactive Cygwin sessions. Disclaimer: I have not tried this.

Edit: I have now tried this; it works just fine. I created a shortcut to PLINK:

"C:\path\to\PLINK.EXE" -A -ssh -l yournamehere localhost "echo $SSH_AUTH_SOCK; while :; do sleep 86400; done"

Then, in a Cygwin terminal (I use PuTTYcyg of course):

export SSH_AUTH_SOCK=/tmp/ssh-crYQh24AMq/agent.3964
ssh-add -l

Seems to work great, but still requires a local sshd.

What would be really great is to have an openssh-compatible agent which communicates directly to the pageant keystore, but this won't happen unless someone writes such a beast. I looked into it many moons ago, and it seemed more trouble than it was worth given that this work-around is easy enough.

Solution 4:

Could you go the other way and use puttycyg?

[http://code.google.com/p/puttycyg/]

That way you have putty as your cygwin terminal.