Solved: Connection to server closed by remote host, idle timeout occurring on linux server ?

In this article, we will see a common error message and how to get rid of this in linux.

I. Error Message

EXIT: [255]
STDERR: [Array
    [0] => Connection to ngelinux001 closed by remote host.


2. Make TCP Keep Alive “Yes” and Set Alive Interval to 30 seconds.

[saket@ngelinux001 ~]$ cat .ssh/config
TCPKeepAlive yes
ClientAliveInterval 30

Now when you logout and login back again, the connection will be made using these options.

And your session will not be closed automatically by remote host.

Similarly we can prevent ssh/scp session to stuck by using options like below.

# This will prevent any kind of timeout without any changes at server end.
# ssh -Y -C -e -o TCPKeepAlive=yes -o ServerAliveInterval=2 user@host
0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments