Difference between revisions of "SSH Timeouts"

(Created page with " Due to the various ssh programs people use to connect to servers, their configuration processes differ, so we cannot tell you how to set up your specific ssh client program...")
 
Line 1: Line 1:
  
 +
Some users might experience a timeout/disconnect after being logged into a system using ssh for some period of time of non-direct activity. For example, you might be logged into one of our Linux systems via ssh, and you might start up a process that is expected to take a long time to run.  However, with no keyboard activity for a while while your process is running, ssh may time out and disconnect your session.
  
 +
Settings to prevent timeouts should be set at the client end, meaning, the system you're using to connect to a remote system.
  
Due to the various ssh programs people use to connect to servers, their configuration processes differ, so we cannot tell you how to set up your specific ssh client program.
+
Due to the various ssh programs people use to connect to servers, their configuration processes differ, so we cannot tell you how to set up your specific ssh client program.  But, we can provide you some info if you run an OpenSSH client, just like our own CS Linux clients use...
  
However, if you use '''OpenSSH''' to connect to a Linux system , you should add the following three lines do your ''~/.ssh/config'' file.
+
== Configure an ''OpenSSH'' Client To Prevent SSH Timeouts==
 +
 
 +
If you use '''OpenSSH''' to connect to a Linux syste , on the system you're coming ''from'', you should add the following three lines do your ''~/.ssh/config'' file to help prevent SSH timeouts:
  
 
:: Host *
 
:: Host *
Line 11: Line 15:
  
  
'''NOTE:'''  these lines will apply to '''''every''''' system you connect to.  You'd have to use a more specific Host line in order tosingle out just the CS Linux systems.
+
'''NOTE:'''  these lines will apply to '''''every''''' system you connect to from your OpenSSH client.  You'd have to use a more specific ''Host'' line in order to single out just the CS Linux systems.
  
 
==Using ''tmux'' Or ''screen'' As An Alternative==
 
==Using ''tmux'' Or ''screen'' As An Alternative==

Revision as of 14:50, 9 January 2020

Some users might experience a timeout/disconnect after being logged into a system using ssh for some period of time of non-direct activity. For example, you might be logged into one of our Linux systems via ssh, and you might start up a process that is expected to take a long time to run. However, with no keyboard activity for a while while your process is running, ssh may time out and disconnect your session.

Settings to prevent timeouts should be set at the client end, meaning, the system you're using to connect to a remote system.

Due to the various ssh programs people use to connect to servers, their configuration processes differ, so we cannot tell you how to set up your specific ssh client program. But, we can provide you some info if you run an OpenSSH client, just like our own CS Linux clients use...

Configure an OpenSSH Client To Prevent SSH Timeouts

If you use OpenSSH to connect to a Linux syste , on the system you're coming from, you should add the following three lines do your ~/.ssh/config file to help prevent SSH timeouts:

Host *
ClientAliveInterval 20
ClientAliveCountMax 5


NOTE: these lines will apply to every system you connect to from your OpenSSH client. You'd have to use a more specific Host line in order to single out just the CS Linux systems.

Using tmux Or screen As An Alternative

One thing many people do for long-running programs is to run them inside a tmux or screen session. That allows the programs to continue even if the SSH session is disconnected.

If you do this, make sure you do come back to check on your programs! Sometimes, people forget about their running programs and leave them, unnecessarily using up computing resources that should be available for other people using our services.

You can learn more about tmux here: https://tmux.github.io/


Linux Clients