Skip to main content

Posts

Showing posts from December, 2019

Command Line Fu - Terminate stuck ssh sessions

This is fairly simple to happen to your daily workflow. If you reboot a server or disconnect your laptop from the current network (say ethernet and switch to wireless) it may occur that your ssh session is not reconnecting automatically and appears to be 'stuck'. The proper escape sequence to disconnect the client would be '~.' Here's an example: [archy@castle-bravo ~]$ ssh archy@example.archyslife.lan Last login: Sat Dec 21 18:40:04 2019 from castle-bravo.archyslife.lan [archy@example ~]$ reboot well, it's stuck ... time to disconnect Connection to example.archyslife.lan closed. [archy@castle-bravo ~]$ What happened here is that by rebooting the server the ssh-server did not have time to appropriately disconnect all sessions and so the client appears to be 'stuck'. In order to disconnect the client, I sent the escape sequence '~.' and drop to my local terminal again. Feel free to comment and / or suggest a topic.