Staying Connected to SSH
Sometimes when you are connected to a remote host via SSH, you’ll get kicked out. There’s a generally accepted method to remain connected: ServerAliveInterval 10 where 10 is the nnumber of seconds between keep alive null packets.
You set it up by adding it to your ~/.ssh/config file like this:
ServerAliveInterval 10 Host mesocardia HostName 173.154.113.16 User rosette Host armorproof HostName 85.26.165.168 Port 22 User rufus
You can also use it as part of your connection command:
$ ssh -o ServerAliveInterval=10 [email protected]
There is another method that disconnects you (auto-logout), and the above will not affect it. You'll know when auto-logout is disconnecting you because the message will look like this:
timed out waiting for input: auto-logout
The solution for this was brought to my attention by drad's blog. Essentially, you set a variable defining the auto logout time. First, check to see what it is:
$ echo $TMOUT 600
If you see an integer, then that's the number of seconds you have before it logs you out. To remove the restriction, simply unset the number by adding this to the remote host user's ~/.bash_profle.
export TMOUT=
With these two techniques, you should be able to stay logged into the remote host indefinitely.












