I've only been using Linux for a few months now and I'm still a beginner so I apologise if I use incorrect terms. I'm running Arch and the remote machine is on Manjaro.

I have been running experiments on a machine in my research department, connecting remotely via ssh (via a tunnel proxy). Before running my code, I start a TMUX session and enter the conda environment I need. After running my code, I detach from the TMUX sessions and will check back up on it occasionaly. I've been doing this for a few months now and could run code for days with no issue.

In the last few days, however, after 20-40 minutes, I get disconnected with the message:

Connection to exampleserver.com closed by remote host.
Connection to exampleserver.com closed.

This happens every time. I'm not sure what could have caused this. I asked the guy in my department who looks after the machine and he told me to adjust the ServerAliveInterval in my ssh config. shouldn't TMUX be looking after my session anyway? What could have stopped it from no longer preventing sessions from disconnecting?

Any help would be appreciated! I can't really work without access to this machine unfortunately.

  • tmux has nothing to do with the lifetime of your SSH session. Ask your system administrator to check whether the disconnect is reported to come from your ssh daemon or not. If not, then it's probably some intermediate device.
    – Chris Down
    Dec 2, 2020 at 22:05

1 Answer 1


Commonly, SSH servers are configured by default to drop connections that have not sent or received any data for a while. It's assumed that the client died or the connection dropped.

You can prevent this by running something that keeps traffic flowing, like top or cmatrix. A less hackish way of keeping the connection alive is included in the SSH protocol. Add the following to your ~/.ssh/config file:

Host *
    ServerAliveInterval 10
    ServerAliveCountMax 12

Increase the ServerAliveCountMax value if you are on a really flaky network connection.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .