Fix SSH Error in Terminal & Linux: client_loop: send disconnect: Broken pipe

The most secure connection to a remote server is through an SSH cryptographic network protocol (Secure Shell).

A common problem encountered by server administrators or those who make connections via SSH via Terminal or Putty, is the sudden disconnection from the session with the message: client_loop: send disconnect: Broken pipe .
Most of the time, this logout message appears after a period in which no command line has been executed in the SSH session. Many prefer to remember the open session from time to time and give another "Enter”Or a“ w ”to keep the session open. A better solution is for this sudden closing of the session after an "idle" period to stop.

How to prevent the sudden end of an SSH session with “client_loop: send disconnect: Broken pipe” in Terminal (Linux / Mac)

For both Linux and Mac, a line will be added in the SSH configuration. We open and edit the file “ssh_config”.

sudo nano /etc/ssh/ssh_config

We add the line:

Host *
ServerAliveInterval 120

Save and close the file "ssh_config". If we are on Linux we will have to restart the "sshd" service.

directive ServerAliveInterval will send a null packet to the server at 120-second intervals to keep the session alive and thus prevent it from closing abruptly.

Fix SSH Error in Terminal & Linux: client_loop: send disconnect: Broken pipe

About the author

Stealth

Passionate about everything that means gadget and IT, I am pleased to write on stealthsettings.com from 2006 and I love to discover new things about computers and macOS, Linux operating systems, Windows, iOS and Android.

Leave a Comment