Do you get annoyed when you have a SSH session open, visit your browser for a while, and then return only to find you were disconnected? Most home NAT routers are the cause of this. If your router doesn’t offer an option to not shut off idle connections, you are probably better off by setting a keep-alive setting.
To do this, just open /etc/ssh/ssh_config on your home (client) computer. Add the following line:
ServerAliveInterval 180
There you have it! Just remember now, if you leave SSH open accidentally, anyone else can get on it. Remember to close your session when finished.



Brian Pence wrote:
If you’re using AbsoluteTelnet (for Windows), you can do this from the Options->Properties->Connection page. There is an option there to enable keepalives and you can specify the duration between them.
Regards,
Brian Pence
# Posted on 19-Feb-08 at 11:15 pm
Lou Palladino wrote:
Make sure your SSH client supports SSH keepalives, or this won’t work either. You can set the TCP keepidle option to the value and that will fix it no matter what service (telnet/SSH) or client you are using. Procedures differ depending on the OS flavor.
# Posted on 20-Feb-08 at 5:11 pm
Hål dina SSH-anslutningar vid liv by admins.se wrote:
[…] Tack för tipset FOSSwire! […]
# Posted on 20-Feb-08 at 7:45 pm
fsdaily.com wrote:
Story added…
This story has been submitted to fsdaily.com! If you think this story should be read by the free software community, come vote it up and discuss it here:
http://www.fsdaily.com/HighEnd/Keep_Your_SSH_Connection_Open…
# Posted on 20-Feb-08 at 11:59 pm
nick wrote:
Why dont you just use a watch command with something simple like ls. for example the command “watch ls -la” and it will do it every two seconds or whatever time you designate. or if you want to make sure there isnt any system load do something like “watch echo “hello”;”
just a suggestion
# Posted on 21-Feb-08 at 9:19 am
little bites of fusion » Blog Archive » Keep SSH Connections Open in Linux [How To] wrote:
[…] are just that—open to any nefarious passer-by, so use session-closing caution when needed. Keep Your SSH Connection Open […]
# Posted on 22-Feb-08 at 5:37 pm
Keep SSH Connections Open in Linux [How To]Lifehacker @ ZDima.net wrote:
[…] open are just that—open to any nefarious passer-by, so use session-closing caution when needed. Keep Your SSH Connection Open [FOSSwire] no comments yet. Top 10 Smart and Lazy Ways to Save Your Workday [Lifehacker Top […]
# Posted on 23-Feb-08 at 4:18 pm
My Linux Web » Keep SSH Connections Open in Linux wrote:
[…] are just that—open to any nefarious passer-by, so use session-closing caution when needed. Keep Your SSH Connection Open [FOSSwire] Bookmark this article! […]
# Posted on 07-Apr-08 at 2:55 am