Well, with the default ssh setup, there is a setting in your ssh_config file called "
ServerAliveInterval". Initially (at least on my system) it is commented out and also has a value of zero (0).
In order to keep your sessions alive indefinitely, you will need to uncomment that variable in the ssh_config file and set it to a value other than zero. I have mine set to 60.
What this variable does is tell ssh that it needs to send a packet across the wire to the connected server so that there is traffic, keeping the connection active, not letting it time out.
So, by to keep your sessions alive, you will need to make the changes as above, but also, do not forget that this change will only effect new connections made after you save the change. If you have active connections, you will need to exit them out and restart them. If you don't, they will still be subject to the same issue you just corrected.
Go now, keep those connections alive!