How to avoid SSH client time out

SSH client will hangs and not usable after a few mins idle time. This can be resolved by two methods.

Prevent SSH timeout on the client side

Open the local SSH config file in ~/.ssh/config and add the following line.

ServerAliveInterval 120

This will send a "null packet" every 120 seconds on your SSH connections to keep them alive.

Prevent SSH timeout on the server side

Open the SSH daemon config in /etc/ssh/sshd_config and modify the following lines.

ClientAliveInterval 120
ClientAliveCountMax 720


Leave a Reply