Prevent SSH session timeout

When using mobile broadband I found that a SSH shell session to a remote server would terminate unless I used it every few minutes. To overcome this use the ServerAliveInterval option to send a regular keepalive message to the remote server, which should be enough for the ISP firewalls to maintain the TCP session indefinitely.

Either add the SSH option via the command line, e.g.

$ ssh -o ServerAliveInterval=60 user@host

Or add the following line to ~/.ssh/config:

ServerAliveInterval 60  # Send a keepalive every 60 seconds

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s