cygport improvements: upload, fish, src_prep_fini_hook

Andrew Schulman
Sat Jan 17 23:27:00 GMT 2015

> You're right, this isn't pretty. :-(  Any progress since then?

OK, here's what I've worked out.

If SSH_KEY is set (in the environment, or in ~/.cygport.conf), then cygport will
load that key into an ssh-agent if necessary.  

* If no ssh-agent is running, cygport will start one and load the key, then kill
the agent when the upload is done.

* If an ssh-agent is running but the key isn't already loaded into it, cygport
will load the key, then unload it again when the upload is done.

In either of the above cases, ssh-add will prompt for a passphrase if needed
when it loads the key.  So in this case, the user will be prompted for a
passphrase if and only if one is needed.  Hooray.

If SSH_KEY is not set, then it's just too hard to figure out what key ssh will
use.  To figure that out, we'd have to reproduce a bunch of logic in ssh,
including parsing the ssh config file, and that's not going to happen.  So, in
this case we just give up and give lftp the connect string
s, which will cause it to prompt for a passphrase every

So this isn't a perfect solution, but I think it's the best available
compromise.  If, like me, you always have your keys loaded into an ssh-agent,
and you don't want to be prompted for an unneeded passphrase on every upload,
then you'll need to do the one-time configuration of setting SSH_KEY in your
~/.cygport.conf file.  Then cygport will be able to figure out that it doesn't
need to prompt you every time.

I've coded the above and tested it in all of the cases of SSH_KEY set/not set,
ssh agent running/not running, private key file encrypted/not encrypted,
loaded/not loaded.  It works for me, but of course more testing is welcome.

Result is pushed to

Thanks to Corinna for the suggestion of using ssh-agent.


More information about the Cygwin-apps mailing list