If you are an administrator and you use SSH To connect with other systems, it will have happened to you more than once that after a while the connection drops and you have to reconnect, with the consequent loss of information. |
This "trick" is well known to any system administrator, but perhaps some of you do not know it.
The idea is that the server forces the client to send a packet to keep the connection open (which is usually known as keep-alive) and is configured on the SSH server to which we connect by modifying the / etc / ssh / sshd_config file and adding these two lines to the ssh daemon configuration:
TCPKeepAlive yes
ClientAlive Interval 60
With this, we only have to quietly restart the ssh daemon and when connecting, we can leave the session open without fear of being disconnected.
Another possible option is to use a tool called autossh. To install it in Ubuntu and derivatives, just run:
sudo apt-get install autossh
In the case that we want to use it in a simple way, we could already execute:
autossh remote_user @ remote_host
Source: sinology
good contribution…
Go just four days ago I wrote something very similar on my blog. Good idea about the autossh: http://totaki.com/poesiabinaria/2012/08/solucionar-problema-con-timeouts-y-broken-pipes-con-ssh-y-scp/
The source for this article is old because "Keepalive" no longer exists as an SSH configuration parameter.
Any ssh client for android that you recommend?
Do you recommend any ssh client for android?
Could it be that the file is called ssh_config and not sshd_config?
and if you still can't avoid crashing because you're on a bad connection or something like that, log in and use screen to unlink your session PID with your connection PID.
Good contribution!
If you do not have access to the SSH server, you can implement it on the client side, with Putty or desde Linux.
With putty:
"Connection", "Sending of null packets to keep session active", "Seconds between keepalives" and enter a number.
Also mark the option:
"Enable TCP keepalives (SO_KEEPALIVE option).
Source: http://www.sysadmit.com/2016/02/linux-y-vmware-ssh-evitar-desconexion.html