Your ssh session is automatically disconnected after the idle time, if you want to keep the connection alive, do as follow:
1. Open terminal
2. Edit ssh_config
2. Edit ssh_config
sudo nano /etc/ssh/ssh_config
3. Add the following line to the end of the file
ServerAliveInterval 5
4. Ctrl+X and enter y to save the files
5. You are done!
You can change 5 to any number, here 5 is the number of seconds for the clients to sends a small keep-alive packet to the server so that the connection is not disconnected.
Hope this help!