Windows ssh-agent toy
Robert Olson
olson at mcs.anl.gov
Mon Sep 15 11:07:28 CDT 2003
If you drop this in some directory, modify it to find a copy of
send-settingchange.exe, and run it, it'll start a cygwin ssh-agent for you
and set up the per-user environment registry var for it so that any new cmd
window you open will have the ssh environment set up for you.
your mileage may vary, it works for me.
--bob
-------------- next part --------------
import re
import _winreg
import os
x = os.popen("ssh-agent")
sock = None
all = ""
for l in x:
all += l
m = re.search("SSH_AUTH_SOCK=([^;]*); export", l)
if m:
sock = m.group(1)
x.close()
if sock is None:
print "Couldn't get socket"
print all
sys.exit(1)
k = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, "Environment", 0, _winreg.KEY_ALL_ACCESS)
_winreg.SetValueEx(k, "SSH_AUTH_SOCK", 0, _winreg.REG_SZ, sock)
os.system(r"c:\home\olson\send_settingchange.exe")
os.putenv("SSH_AUTH_SOCK", sock)
os.system("ssh-add")
More information about the ag-dev
mailing list