[patch] OpenSSH ssh-agent -x new option, to define variables in Windows user environment variables

Sébastien Santoro dereckson@espace-win.org
Tue Oct 15 02:01:00 GMT 2013


Hello,

I prepared a patch to add a new option in ssh-agent:

$ ssh-agent -x
setx SSH_AUTH_SOCK /tmp/ssh-kVGrQ1K2lcMW/agent.3664
setx SSH_AGENT_PID 2704
echo Agent pid 2704;

It works the same way than -c or -s flag, but offers to use setx.

setx writes variables to the master environment in the registry, by
default in HCKU.
This is the same than to go the system properties to define user variables.

It's then available to the whole system for the current user,
including GUI applications.

This is an alterantive to complicated scripts or old tricky solutions like:
http://www.cygwin.com/ml/cygwin/2001-01/msg00063.html

I use it without any script, launching a cmd.exe console and writing
ssh-agent | sh, then closing it (ssh-agent offers a shell detection,
the patch help it to detect cmd.exe too, when the SHELL environment
variable isn't defined).

And that's more natural, more in the usual ssh-agent way.
With one drawback: it's not available in the current shell process,
only for future ones.

Patch URL:
http://dereckson.devio.us/patches/OpenSSH-20130830-CygwinSSHAgentSetx.patch

The setx documentation:
http://technet.microsoft.com/en-us/library/cc755104.aspx

A note about setx availability:  it's included in the base system
since Windows Vista and were before available in the resource kit
since Windows 2000.

I use it for 6 weeks and I'm happy with that.

My plan is:
(1) to gather feedback from Cygwin community
(2) if positive, to submit the patch to the Portable OpenSSH development team

Do you have some feedback?

-- 
Sébastien Santoro aka Dereckson
http://www.dereckson.be/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list