How to Change or Disable SSH Timeout

On Client

sudo vi /etc/ssh/ssh_config

add line

ServerAliveInterval 100

On Server

sudo vi /etc/ssh/sshd_config

add lines

ClientAliveInterval 30
TCPKeepAlive yes
ClientAliveCountMax 99999

From command line per session

ssh -o ConnectTimeout=10

ssh -o ConnectTimeout -o BatchMode=yes -o StrictHostKeyChecking=no

ServerAliveInterval operates on the ssh layer. It will actually send data through ssh, so the TCP packet has encrypted data in and a firewall cant tell if its a keepalive, or a legitimate packet, so these work better.

ssh -o ServerAliveInterval=5 -o ServerAliveCountMax=1

You may also like...