Client_loop: send disconnect: Broken pipe

I login as my-user-name@my-server-domain-name-here and I am getting this error when I leave my ssh session open for some time

client_loop: send disconnect: Broken pipe

How can I fix this and stay connection up?

Check your sshd:

vim /etc/ssh/sshd_config

search for ClientAliveInterval - Is it commented or Uncommented?

If it’s you can uncomment it, or increase the interval, Or just comment it out. Let me know how it goes.

I see it when I leave my ssh connection open for a long time. Another reason is when my WiFi or Internet discounts, I see client_loop: send disconnect: Broken pipe message. This is harmless message. As @shehuawwal said set a value for ClientAliveInterval. From sshd_config page:

Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client.

sudo nano /etc/ssh/sshd_config

Set to 300

ClientAliveInterval 300

Restart our sshd server:

sudo systemctl reload sshd.service

Also Mosh client is useful when working using the mobile Internet/WiFi. It’s more robust and responsive, especially over Wi-Fi, cellular, and long-distance links.


You should/can use SSH/SCP argument ‘-o’ to accomplish that, no need to set your (if you’re admin) server’s ssh-config.

SSH options related to keeping connection alive are TCPKeepAlive, ServerAliveCountMax, ServerAliveInterval. The man pages – – can give you some nice detailed information, but basically it goes like this:

% ssh -o TCPKeepAlive=yes -o ServerAliveCountMax=20 -o ServerAliveInterval=15 my-user-name@my-server-domain-name-here

to have the client sending “keep-alive” messages every 15 seconds. If the limit of 20 consecutive messages do not get an answer back from the server – which accounts for 20x15 = 5 minutes – then it is understood the connection is broken/dead and the client process ends.


Look into my tutorial which explains various solutions:

1 Like

Little typo, it’s systemctl

1 Like

I edited @tomboi’s post to fix the typo.

1 Like