I keep a screen session running on a dev box at work, and I ssh into my dev box and resume my screen session while I'm at work. From there, I hop to other machines.
Occasionally, I find myself ssh'ing to a remote host from my already-remote-screen-session-over-ssh when that remote host I'm ssh'ed to doesn't allow me to disconnect cleanly. So I end up needing to force my remote (second) ssh session to die without affecting my original ssh session connected to screen. I know that killing ssh is done with a
~., but like I said, my local ssh client intercepts that key-combo accomplishing nothing more than my needing to reconnect ssh to my dev box.
Anyone ever run into this? How do I terminate the remote ssh session in screen without killing my original ssh session? I'm unable to find anything apropos in screen to do it. This also goes for additional hops IE ssh -> screen -> ssh -> ssh (unable to logout cleanly) <- want to force kill this ssh session.
I tried running
~~., which kills the second ssh session, and that kind of works. It's not good enough for say a third, fourth, or more hop, though.
It would be nice to have a solution that works however deeply nested I am ssh'ed into other machines.