How to Keep Your Linux SSH Session Alive
Add the following line to the /etc/ssh/ssh_config file:
The number is the amount of seconds before the server with send the no-op code.
Current User Configuration
Add the following lines to the ~/.ssh/config file (create if it doesn’t exist)
Make sure you indent the second line with a space.
If you only want to enable keep alive for a single server, you can add that into the ~/.ssh/config file with the following syntax: