Ssh – packet_write_wait: Broken Pipe error on MacOS Sierra SSH to Amazon EC2

amazon ec2mac-osxssh

I keep getting a packet_write_wait: Broken Pipe error on my EC2 SSH connections after a period of inactivity.

I've tried modifying the ServerAliveInterval & ClientAliveInterval settings with different values ranging from 5 to 120. I've also tried changing the TCPKeepAlive setting to no or yes. I've tried applying these settings to the config at /etc/ssh/sshd_config and ~/.ssh/config (I've tried these in a Host * block and a Host SERVER.COM block.)

Yet, I keep getting disconnected with a packet_write_wait: Broken Pipe error. How do I correct this issue?

Best Answer

This means that there is a huge packet loss for a long time or route change between you and AWS (not necessarily your provider, it might be your router or intermediate provider too), so even tcp keepalives are left unanswered. Inspect your traffic, every sent and received packet on both sides with wireshark/tshark in background. If you'll see that data is not delivered or there is a TCP retransmission - this is where the problem belongs to.

Related Topic