I got timed out of a ssh session. Is there a way I can switch back to it if it still exists?

asked 12 Apr '11, 14:54

electronbender's gravatar image

accept rate: 0%

If the session timed out, the socket is closed.
you can add a shorter time for the TCPKeepAlive to prevent server timeout. The problem with doing that is that you run the risk of your client noticing a temporary loss of routing or something like that.
I have experienced this kind of difficulty with ssh through a proxy. I usually set me TCPkeepAlive value to 150 or less in those cases.
You can modify it on a per-host basis in your ~/.ssh/config like so:

Host yourhost.localdomain
User bfallor
**TCPKeepAlive 150**
Host myhost.localdom. . .

or you can edit the /etc/ssh/ssh_config and modify the setting:

TCPKeepAlive 150

I believe the default is 300, iirc.


answered 12 Apr '11, 15:45

davdunc's gravatar image

accept rate: 50%

Use gnu screen!

screen allows you to attach and detach sessions. Basically, you ssh somewhere, start screen at that location, and run everything in that session. You can detach that session using Ctrl+a, d, and reattach it using screen -r.

If your ssh session dies, everything is still up and running in your screen session.


answered 12 Apr '11, 15:38

Jazz's gravatar image

Jazz ♦
accept rate: 33%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 12 Apr '11, 14:54

Seen: 3,127 times

Last updated: 12 Apr '11, 15:45

powered by OSQA