On my home WiFi connection, I occasionally find my SSH sessions being stuck and completely unresponsive. The only way to resolve the issue has been to close the window of the terminal emulator, which is usually no big deal. This becomes more of an issue when using ChromeOS on my CR48 where you can't close the shell window by any means other than the "exit" command. Prior to discovering a more graceful solution, I had been using this somewhat lengthy workaround (which requires ChromeOS to be in dev mode):
- Press Alt-Ctrl-T to open a new crosh shell.
- Type "shell" to open a Linux shell.
- Run "ps fax | grep ssh" to find the process id of the stuck ssh session.
- Kill the stuck session with "kill -9 [process ID]"
Killing the process manually is not ideal, especially when your WiFi drops whenever the router yawns.
This solution that is built into the standard openSSH client takes a lot less time and closes the connection as opposed to just killing the client process. When the session is stuck, press the following keys to close the SSH connection:
- Tilde ( "~" / shift back-tick )
That's it! Your connection will be closed with the "Connection to [host] closed" message. I hope that you find this tip as useful as I did. Happy hacking!