Answers to: Can i switch to a timed out ssh session?http://linuxexchange.org/questions/2325/can-i-switch-to-a-timed-out-ssh-session<p>I got timed out of a ssh session. Is there a way I can switch back to it if it still exists?</p>enTue, 12 Apr 2011 15:45:48 -0400Answer by davdunchttp://linuxexchange.org/questions/2325/can-i-switch-to-a-timed-out-ssh-session/2327<p>If the session timed out, the socket is closed.<br> 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.<br> 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.<br> You can modify it on a per-host basis in your ~/.ssh/config like so: </p> <pre><code>Host yourhost.localdomain User bfallor **TCPKeepAlive 150** Host myhost.localdom. . . </code></pre> <p>or you can edit the /etc/ssh/ssh_config and modify the setting: </p> <pre><code>TCPKeepAlive 150 </code></pre> <p>I believe the default is 300, iirc.</p>davduncTue, 12 Apr 2011 15:45:48 -0400http://linuxexchange.org/questions/2325/can-i-switch-to-a-timed-out-ssh-session/2327Answer by Jazzhttp://linuxexchange.org/questions/2325/can-i-switch-to-a-timed-out-ssh-session/2326<p>Use <a href="http://www.gnu.org/software/screen/manual/screen.html">gnu screen</a>!</p> <p><code>screen</code> allows you to attach and detach sessions. Basically, you <code>ssh</code> somewhere, start <code>screen</code> at that location, and run everything in that session. You can detach that session using <code>Ctrl+a, d</code>, and reattach it using <code>screen -r</code>.</p> <p>If your ssh session dies, everything is still up and running in your screen session.</p>JazzTue, 12 Apr 2011 15:38:14 -0400http://linuxexchange.org/questions/2325/can-i-switch-to-a-timed-out-ssh-session/2326