I have what is probably a very simple terminal related question. I'm running Ubuntu 8.10 Intrepid Ibex, using Gnome, and I often open a terminal-based ssh session only to have it dropped at some point later on. Once the session is dropped the terminal becomes unusable, obviously because the network connection has been dropped.
Is there a way to re-initialize the session, or even revert to a working local terminal?
Under Windows, using putty, when this happens I can right-click and select restart session, and do not need to open a new terminal, however under linux my lack of understanding on this subject has lead me to always close the defunct terminal, and restart a new one from scratch. I'd like to learn a new and useful trick if there's one out there.
Also, I found the following post which is worded very similarly to mine,
Automatically (or more easily) reconnect to a screen session after network interruption reconnect-to-a-screen-session-after-network-interr
however, as far as I can tell, this is a different topic.
You want to use your SSH escape. By default it's '~', and ~. will terminate your connection.
The question you linked to is about screen, which is useful for resuming your remote session once you use the escape character to kill your local ssh process and reconnect.
First use ~.
to disconnect your ssh connection locally. This gets you back to a working local terminal. You could also you another terminal to kill the appropriate ssh command.
In order to keep your remote state you should use screen
as previously suggested.
I recently found out about mosh which is a interesting UDP-based resumable shell client. It uses ssh to initialise the connection, and probably needs mosh installed at the server (and UDP access between the client and server), however it can recover from disconnections and IP changes of the client.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With