sshd (the server) closes the connection if it doesn’t hear anything from the client for a while. You can tell your client to send a sign-of-life signal to the server once in a while.

User’s configuration

The configuration for this is in the file ~/.ssh/config, create it if the configuration file does not exist. To send the signal every four minutes (240 seconds) to the remote host, put the following in your ~/.ssh/config file.

Host *
ServerAliveInterval 240

Also make sure to run, to prevent config file to be world-readable:

chmod 600 ~/.ssh/config

Global configuration

We can keep our ssh connection alive by having following Global configurations. Add the following line to the /etc/ssh/ssh_config file:

ServerAliveInterval 60

Source: http://stackoverflow.com/questions/25084288/keep-ssh-session-alive


Victor Dias

Sharing mobile Experiences

Follow me