Keeping SSH Connections Alive In Linux

If you need to work constantly on SSH, it’s very frustrating when the system cuts you off after a period of time. Here, I’ll show you the method to keep SSH connections alive until you disconnect.

sudo nano /etc/ssh/ssh_config

Then add the following at the end of your host:

ServerAliveInterval 30

This sends a null packet to the server every 30 seconds (of inactivity) to keep the SSH connection alive. You can set it to either higher or lower, depending on your system configuration.

Leave a Comment

Your email address will not be published. Required fields are marked *