Disable SSH timeout
http://www.techrecipes.net/linux/disable-ssh-timeout.html
By default, most SSH servers are configured to forcibly disconnect inactive or idle clients, or actually those with no network activity. This is not good for some people especially if one is setting up a (reverse) tunnel to the server where the tunnel should remain established whenever they need it.
There are 2 methods to overcome this problem,
1) not to stay idle or by keeping the network activity busy, and
2) if you have root access to the server, change the SSHd configuration at the server.
How can the network be kept busy while you are not attending the session? The trick is to run any program that keep updating the screen, such as mtr or top. The program should generate some network activity, and keep the session active and connected. Use the program screen to create virtual terminals where one terminal is dedicated to the program mtr or top.
If you have root access to the server, you might want to just change the SSHd configuration file. To do this, edit the file /etc/ssh/sshd_config and change the following options as in the example below;
TCPKeepAlive yes ClientAliveInterval 30 ClientAliveCountMax 99999
Don’t forget to restart the SSH server afterwards with the following command;
# /etc/init.d/sshd restart