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@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.
Flavien,
you are right, this sounds like an old problem. I can redirect you to
this thread
http://www.derkeiler.com/Newsgroups/comp.security.ssh/2007-0[..]
and this bug https://bugzilla.mindrot.org/show_bug.cgi?id=396 in which
it is discussed and a patch proposed for 4.6p1. I think that modifying
the proposed patch for the latest version should be straightforward.
IMHO, having the proposed option "RemoteCommandCleanup" in the main
branch would be really interesting/necessary.
Regards,
Matthieu