useful cygwin ssh-agent script

This is n generations tweaked, but it's now useful for me under any of my 
*nix hosts. Previously on win32 I was doing all kinds of nasty stuff with 
setx to push these variables into the global NT environment space, but the 
file approach is much simpler. (However, people should be cognizant of the 
potential dangers of ssh-agent under cygwin [1], though under a local 
netstat and remote portscan it does not appear that the port specified in 
/tmp/ssh-foo is accessible to anyone ...?)



function start_agent {
     echo "Initialising new SSH agent..."
     /usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
     echo succeeded
     chmod 600 ${SSH_ENV}
     . ${SSH_ENV} > /dev/null

# Source SSH settings, if applicable

if [ -f "${SSH_ENV}" ]; then
     . ${SSH_ENV} > /dev/null
     #ps ${SSH_AGENT_PID} doesn't work under cywgin
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
Joseph Reagle     E0 D5 B2 05 B6 12 DA 65  BE 4D E3 C1 6A 66 25 4E
MIT LCS Research Engineer at the World Wide Web Consortium.

* This email is from an independent academic account and is
not necessarily representative of my affiliations.

Received on Friday, 8 June 2001 14:32:32 UTC