Cheatsheet Pages / SSH Cheatsheet
How to stop SSH sessions from freezing — ServerAliveInterval keepalive
Idle sessions keep dying behind NATs and firewalls.
Every flag and config keyword was checked against the OpenSSH 9.6 man pages, and the config examples were parsed for real with ssh -G.
ssh -o ServerAliveInterval=60 -o ServerAliveCountMax=3 deploy@example.com
# ping the server every 60s; give up after 3 unanswered pings
# (both are also ~/.ssh/config keywords — see the config section)
Good to know
The client pings the server every 60 seconds and gives up after 3 unanswered pings. Both options are also ~/.ssh/config keywords.
