killing remote commands

Flavien flavien-ssh at lebarbe.net
Thu Oct 21 20:07:18 EST 2010


Dear ssh gurus,


Here's the version I'm testing on :
    flavien :/$ ssh -V
    OpenSSH_5.3p1 Debian-3ubuntu4, OpenSSL 0.9.8k 25 Mar 2009

I launch a remote command :
    flavien$ ssh -o ControlMaster=yes -o ControlPath=/tmp/ssh-control localhost 'echo pid:$$ ...sleeping...; sleep 2803'
    flavien at localhost's password: 
    pid:11565 ...sleeping...

On another shell, I kill the ssh client :
    flavien$ ssh -o ControlPath=/tmp/ssh-control -O exit localhost
    Exit request sent.
    flavien$

The ssh client is killed in the original terminal. Fine. However, the
shell at the other end is not killed :
    flavien$ ps -ef | grep 2803
    flavien  11565     1  0 10:37 ?        00:00:00 bash -c echo pid:$$ ...sleeping...; sleep 2803
    flavien  11566 11565  0 10:37 ?        00:00:00 sleep 2803

If the remote process is an interactive shell, however, it is killed
once the ssh client terminates. I suspect that's because the shell
gets an EOF on its stdin. Is this true ?

For reading this ml for a few years, I have in mind some sort of
"signal forwarding" feature that would send a SIGINT to the remote
processes. Am I making this up ?

TIA,

Flavien.


More information about the openssh-unix-dev mailing list