I use ssh -p8520 username@remote_host to login remote server.

Issue .

It's always connected to me and works properly when i'm at work Unfortunately, terminal freezes in 10 - 15 minutes after i connected with the remote server from home.

The console still does not show the errortimeout report but the cursor will not move any more

When enter w to check the login users, some zombies login users are there, and I have to kill them manually.

This is very annoying How can someone help me out?

Best Answer


The ssh daemon (sshd), which runs server-side, closes the connection from the server-side if the client goes silent (i.e., does not send information). To prevent connection loss instruct the ssh client to send once in awhile a sign of life signal to the server

The configuration for this is in the file $HOME/.ssh/config , create the file if it does not exist (the config file must not be world-readable, so run chmod 600 ~/.ssh/config after creating the file). To send the signal every e.g. four minutes (240 seconds) to the remote host, put the following in that configuration file.

Host remotehost
    HostName remotehost.com
    ServerAliveInterval 240

To enable the sending of a keep-alive signal for all hosts place the following contents in the configuration file

Host *
    ServerAliveInterval 240