What exactly causes a ssh connection to interrupt? When you idle for a while, it disconnects.
How do I keep the connection alive (without
autossh or reconnect)?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
This is most likely a firewall which cuts your idle connection after a while.
You can configure the
openssh server or client to send a KeepAlive after a while.
Send a KeepAlive every 5 minutes to the server:
ssh user@server -o ServerAliveInterval=300
If you have control over the
openssh-server, you can also send KeepAlives to the client after a defined interval. Add the following to
ClientAliveInterval 300 TCPKeepAlive yes
TCPKeepAlive should be
yes by default.
openssh-server after the modification:
Here are a few things you can try:
1) It's most likely the shell which is timing out. Disable the timeout by unsetting
TMOUT in your profile.
TMOUT is the number of seconds that bash waits for input before terminating. Echo
$TMOUT to see if it is set. Add the following to your profile:
2) Configure PuTTY to send keepalive packets by going into:
Settings > Connection > Seconds between keepalives = 60
3) Tweak your
sshd_config (normally found in
/etc/ssh) and add:
TCPKeepAlive yes ClientAliveInterval 60
Save the file and restart