Keeping or stopping TCP forwardings when the foreground process quits?
Philipp Marek
philipp at marek.priv.at
Wed Sep 8 16:31:52 AEST 2021
>> I'd also like such behavior, but I don't know if the session owner
>> (the Master process) can reliably tell when a Slave process exits?
This is easy, because the Slave process is connected to the Master
process
via a socket. When that gets closed, the Slave is gone (or vice versa ;)
>> A first step might be to enable Slave processes to not only add but
>> also remove previously established channels?
> Perhaps, when explicitly doing forwarding, you could
> add "-o ControlMaster=no" to the command line (or alias
> or script). If I understand correctly, that should work
> now, without any changes to ssh.
Yes, of course.
If I remember that I've configured ControlMaster on that connection,
and that SSH will then use the Master for that,
I might also remember that.
(Although that partly defeats the ControlMaster setting -
connect latency, re-authorization, another TCP channel, ...)
I'd hope for some setting (in future versions of SSH) that says
"when a slave process is gone, remove its port forwardings as well".
More information about the openssh-unix-dev
mailing list