This tutorial solves the problem of sudden disconnection SSH in Linux Client_loop: Send Disconnect: Broken Pipe.
The safest connection to a remote server is through a SSH cryptographic network protocol (Secure Shell).
A problem commonly encountered by server administrators or those who make connections through SSH via Terminal or Putty, is the sudden disconnection of the session with the message: “client_loop: send disconnect: Broken pipe“.
Most of the time, this disconnection message appears after a period in which no command line has been executed in the session SSH. Many prefer to remember from time to time when the session open and give more “Enter” or a “w” for the session to remain open. A better solution is that this sudden closure of the session after a period of “idle” to have no place.
How to prevent the sudden completion of a SSH session with the Customer_loop Error: Send Disconnect: Broken Pipe in Terminal (Linux / Mac)
Both for Linux and for Mac, a line will be added to the SSH configuration. We open and edit the file “ssh_config“.
sudo nano /etc/ssh/ssh_config
We add the line:
Host * ServerAliveInterval 120
We save and close the file “ssh_config“. If we are on Linux we will have to restart the service “sshd”.
Related: Prevent SSH Connection Timing Out / Broken Pipe
Directive “ServerAliveInterval“ It will send at 120 -second intervals a null package to the server to maintain the session in life and thus will prevent its sudden closure.
If you are only changing ssh_config (and not sshd_config) there is no reason to restart sshd.
Very good explanation. Thank you for your article