1.5.24: rxvt or console fail to shutdown due to ssh -f still running despite setsid()

Ken Shaffer strobelight.audio@gmail.com
Mon Apr 9 21:51:00 GMT 2007


> I have just checked the source for the daemon() function and the setsid executable. They
> both call fork() and then setsid(). Do the console/rxvt process stick after calling ssh -f
> because file descriptors are left open? Can you suggest a strategy to deal with this?

I'm not running ssh as a daemon. What I do in order to ssh to another
computer from any other shell is to keep one shell open all the time
running the agent. This is accomplished via the startssh function. In
the function I alias exit to call the stopssh function assuming of
course that this shell is the last to close.  My rxvt closes just fine
this way. You only want to startssh one time. The alias ssh then
sources in the current agent information and calls the real ssh.

startssh()
{
    KSAGENT="`type ssh-agent 2>/dev/null|sed 's/.* is //'`"
    if [ -n "$KSAGENT" ]; then
        ssh-agent |sed '/echo Agent pid/d' > $HOME/.ssh/current_agent
        source $HOME/.ssh/current_agent
        ssh-add
        PROMPT_COMMAND='echo -n -e "\033]0;SSH-AGENT Started! $PWD\007"'
        alias exit='stopssh;exit'
    fi
}

stopssh()
{
    eval `ssh-agent -k`
}

alias ssh="source $HOME/.ssh/current_agent;ssh"

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



More information about the Cygwin mailing list