How to Kill SSH Connection When Network Disconnects

2

I know this is an odd request, but we've been asked to destroy an existing SSH connection as soon as a network disconnect is detected, e.g., if the network cable is unplugged. SSH normally works hard to keep its connection alive for quite some time, in hopes that the network will eventually come back, but we're told this is unacceptable and a network disconnect should trigger an immediate SSH termination.

Note this is different from the Client/ServerAlive settings, which time out after a period of inactivity.

I can't find any SSH configuration settings that would give us this type of behavior. We've tried changing TCPKeepAlive settings on both client and server side, but this just results in a hang.

SixDegrees

Posted 2019-10-29T16:46:45.057

Reputation: 163

How immediate? Are very short Client/ServerAlive settings immediate enough? – Kamil Maciorowski – 2019-10-29T17:07:56.103

Short Alive settings aren't acceptable; we still want SSH to persist during idle periods, but die on loss of network within a couple of seconds. – SixDegrees – 2019-10-29T18:04:34.723

No answers