SEE "For Readers of English Version",
or Japanese version of this page

win-ssh-wrap

There is the problem that processes, whcih are invoked earlier than win-ssh-agent, can not receive SSH_* environment variables. This page explains win-ssh-wrap, the wrapper program which solves this problem.

This software is licensed, which is known as "MIT/X style" license.

Motivation

According to my trial on TortoiseHG (which provides graphical UI for Mercurial repositories in the same way as TortoiseCVS and TortoiseSVN), it does not seems to be able to cooperate with Cygwin ssh at inter-repository operation(e.g.: push/pull), if you want to use public key authentication with the private key encrypted by passphrase.

Usually, when you use the private key encrypted by passphrase, ssh can accept passphrase from:

(Please see ssh explanation sites for detail)

"from command line interaction" has no meaning when TortoiseHG is invoked from Explorer, because it has no "command line".

Though "... SSH_ASKPASS ..." should be available according from description of ssh manual page, it does not work in Cygwin environment, in fact.

note: Cygwin ssh(= OpenSSH) chooses "... SSH_ASKPASS ..." way, when "/dev/tty" is available. But "/dev/tty" seems to be available from Cygwin programs, even though they are invoked without tty.

So, Cygwin ssh never chooses "... SSH_ASKPASS ..." way.

TortoiseHG can not receive SSH_AUTH_SOCK environment variable, because it is invoked from Explorer which can not recognize SSH_AUTH_SOCK environment variable: the process of Explorer(not "Internet Explorer") seems to be invoked earlier than win-ssh-agent, even though you invoke it from "startup" of MS-Windows.

Because of mentioned above, ssh client of PuTTY which bundled with TortoiseHG seems to be used ususally.

And so, you should (1) do:

for both Cygwin ssh and PuTTY ssh to use them together, (2) use ssh client of PuTTY regularly instead of Cygwin ssh, or (3) give up to use TortoiseHG itself.

But I want to (4) make Cygwin ssh cooperate with TortoiseHG.

Principle

win-ssh-agent makes SSH_AUTH_SOCK referencable from processes, which are not in descent of it, via Windows registry entries.

Conversely, the process which can read Windows registry entries for environment variable can cooperate with ssh-agent, even though its parent process does not know required environment variables.

You can not make Cygwin ssh read Windows registry entries directly, but:

the intermediate program, which invokes Cygwin ssh with required environment variables, can make Cygwin ssh cooperate with ssh-agent.

Effect of win-ssh-wrap

win-ssh-wrap makes the most recent SSH_AUTH_SOCK environment variable referencable from even Cygwin ssh invoked after win-ssh-wrap. So even if:

you can make Cygwin ssh cooperate with win-ssh-agent.

How to install/use

  1. download archive,
  2. extract it by gunzp + tar,
  3. "cd" to extracted directory,
  4. compile programs by "make all" and
  5. copy built *.exe files to any location (e.g.: /usr/local/bin or ~/bin)

*.exe files shown below are built by steps above.

Please use these "w-" prefixed commands when you use ssh commands.

Please see README.en.txt contained in archive for detail.