1

http://www.golinuxhub.com/2013/03/setting-up-custom-tcpip-keep-alive.html

Once I connect to my development server, I don't want it to automatically disconnect unless I quit my terminal.

What settings should I use?

Alex
  • 8,471
  • 26
  • 75
  • 99

1 Answers1

4

So here are two fixes. The first is server side.

  1. ssh to your server, and as root or sudo edit the file /etc/ssh/sshd_config then add the line:

    ClientAliveInterval 60

    This will send a timeout signal to the client every 60 seconds. The client (your desktop/laptop) is expected to be alive and answer. If it does, all is well. If not, the signals will continue every 60 seconds until a maximum count is reached (default is 3). Then the server will disconnect. So: if your client is connected and live, even if it is idle, this line in /etc/ssh/sshd_config will ensure no timeout happens. The maximum count can be set with:

    ClientAliveCountMax 3

    (default is 3). But you don’t really need to do that. You will now need to restart your ssh server:

    sudo service ssh restart

  2. Alternatively, on the client side (your own desktop/laptop) edit the /etc/ssh/ssh_config (again, as root or sudo) and add the following line:

    ServerAliveInterval 60

    This is good for when you either don’t have root on your server, or you just don’t want to mess around with configuration files on the server itself.

abzcoding
  • 147
  • 6