SSH timeout

So I host a two websites on my server and I also run tmux with weechat-curses inside. Normally (well up until about 8PM EDT), I would SSH into my linode, then issue 'tmux attach -d' and open up my tmux session and watch IRC while doing other things. However, now when I do this after roughly 3 minutes (even if I am active typing during the 3 minutes) I get disconnected from the Linode and issued this error:

"Timeout, server not responding."

When I SSH back in everything is as it was right before I got disconnect, tmux is still running and weechat is still connected to the IRC network.

So here is what I have tried: I change my ~/.ssh/config to have the TCPKeepAlive and ServerAliveInterval lines. This did nothing.

Host idle

TCPKeepAlive yes

ServerAliveInterval 20

Hostname 173.255.236.80

User yano

I even tried adding "ServerAliveInterval 60" to /etc/ssh/ssh_config and then did "sudo /etc/init.d/sshd restart" and reconnected.

I even stopped MySQL (which I don't even use and it was only running from an incomplete mail server setup), Apache, and NTP. I was thinking maybe there was some high traffic coming on my server.

I've also tried connecting from a different ISP.

I even reverted my SSH config file back to the original and restart SSHD, no luck.

I contacted support but they didn't mention anything about possible network problems on there end, so I'm left to assume this problem is either with my VPS SSH configuration on computer I'm connecting from, or the ISPs I'm testing from.

Any ideas?

3 Replies

I believe the following would fix the SSH disconnect problem:

In the /etc/ssh/sshd_config on your linode (server)

KeepAlive yes

ClientAliveInterval 120

ClientAliveCountMax 5

This causes the linode to send keepalives to the client every 120 seconds and allow the client to fail to respond 5 times before disconnecting.

Fixed. It seems it was a problem with the first two ISPs that I was on. I tried a third one and I'm no longer experiencing the problem. They might have been doing something to the network late at night.

I added those options, awitko. Hopefully, if the ISPs start to go a bit crazy that'll keep it from disconnecting. Thanks!

BTW, I do see smaller clientaliveintervals used, but I think this is the reason some observe that with spotty internet connections it may make matters worse. That is because if you send a clientalive every 20 seconds, for example, and you have the default maxcount at 3, then if the connection drops out for a minute (bad wifi, etc.) while the ssh was idle you will drop the ssh connection even if there is plenty of time left before timing out.

I think windows has a default timeout of 10 minutes for idle network connections so that is another constraint. I would think that could be changed by a regedit. I spread my clientalives over this interval. Now that I think about it might shave a couple seconds off the interval to make sure all five pings get in under the timeout period.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct