Issue :
The SSH connection times out on few minutes of inactivity.
Fix :
Most likely, you are using SSH protocol 2 .
To get around the above problem, you can simply increase the ClientAliveInterval in the file /etc/ssh/sshd_config to (say) 300 seconds.