Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

behnampmdg3's avatar

SSH logs out randomly pretty much after each command. Broken pipe

Why does it log out randomly? Even after doing basic commands like ls -la

[mygoldmembers@host cache]$ ls -la
total 16
drwxr-xr-x  4 mygoldmembers mygoldmembers 4096 Apr  6 22:18 .
drwxr-x--- 15 mygoldmembers nobody        4096 Apr  7 21:12 ..
drwxr-xr-x  2 root          root          4096 Apr  6 22:18 files
drwxr-xr-x  3 root          root          4096 Apr  6 22:18 repo
[mygoldmembers@host cache]$ Write failed: Broken pipe
Behnams-MBP-2:goldmembers$
0 likes
1 reply
bobbybouwmann's avatar

This is a thing that's really hard to debug without being on your computer! However you can for example set some timeouts in your SSH config to keep the session alive: https://askubuntu.com/questions/127369/how-to-prevent-write-failed-broken-pipe-on-ssh-connection

If you for example use zsh you might have added some custom scripts, they can also make this Broken pipe happen. So try to go vanilla first and try again. If you still get problems we probably need more info ;)

Please or to participate in this conversation.