0

This question already has an answer here:

Sometimes my SSH session of my PC and Raspberry Pi is aborted, due to some network issues, eg. WIFI disconnected and connected back on PC. After that SSH client on PC (Putty) is saying that existing session is disconnected.

Question is: Is there any possibility to restore the previously started session? I want to avoid of starting a new one.

marked as duplicate by Ghanima Mar 20 at 17:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

You cannot revive the ssh session once disconnected. Sometimes if the network drops for a short enough time the session never disconnects, but once disconnected it is gone. That's a security feature.

You can, however, keep your terminal session active between ssh sessions. Check out the Linux programs screen or tmux.

  • I typically use "screen" to create a persistent and recoverable terminal. While that's probably its most basic feature, it has many capabilities and is worth reading the docs (man screen) , etc. to learn about these capabilities. Terminal must be under "screen" control or it wont be recoverable later (just type "screen" at the command prompt to put it under screen control). To recover (after getting kicked off), re-login and type "screen -r". I have not used tmux so I can't comment or compare (screen has been around for ages). – Tim Campbell Mar 20 at 16:49
  • @TimCampbell: that's what I just wanted to ask regarding screen, but you have already answered. Only thing that I used screen -r 'session_name' instead of screen -r. It works the way I want, thanks! – majki Mar 20 at 18:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.