Connection hang, can't stop SSH

Philipp Marek philipp at marek.priv.at
Wed Oct 14 20:31:01 AEDT 2020


Using OpenSSH_8.3p1 I had an open (working) connection to some other
box; after a bit of inactivity, some device in the middle seems to have
forgotten about the TCP connection (NAT) and broke it.

I've got an EscapeChar defined, though; so first I tried to send a BREAK
and, when that didn't help (TCP already gone, packets get lost!), I
tried (just out of curiosity) a Rekey.

Now I can see my TCP side hanging with about 4KB in the socket buffers -
but the SSH process (that previously reacted fine upon my EscapeChar)
now is completely dead.

- EscapeChar doesn't work
- Ctrl-Z doesn't work
- Ctrl-C doesn't work


strace shows ssh hanging in
     pselect6(8, [3], [], NULL, NULL, NULL...


So yeah, my fault for trying a rekey on a broken connection... but I'd
have thought that my EscapeChar stays available, so that I can easily
get my terminal back!
(Yeah, I can just kill ssh from another. But what if it was my last
terminal after breaking the sshd setup?!?!)


Is it easy to get EscapeChar working all of the time?


Thanks!

Ph.


More information about the openssh-unix-dev mailing list