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?
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 https://mosh.org/ 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 – https://linux.die.net/man/5/ssh_config – 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:
https://www.cyberciti.biz/tips/open-ssh-server-connection-drops-out-after-few-or-n-minutes-of-inactivity.html
Little typo, it’s systemctl
I edited @tomboi’s post to fix the typo.
You can solve this problem if you are using subsystem then you need to ensure that those owner should be root not any other and also permissions should be restrictive
I had also faced this problem
Client_loop: send disconnect: broken pipe
Because I was given all permissions to all other users that was created problem
And seen me /var/log/auth.log and caught error that I was given full permissions to all users that was created problem
And after changing permissions it connected successfully
I was surprised that this is because of this need less permissions
sudo chown root:root /rooted/Environment
sudo chmod 755 /rooted/Environment