packet_write_wait: Connection to XXX : Broken pipe

In general, I can connect to a remote machine via SSH without any troubles but occasionally in some particular setup, although I can connect to the remote machine and type commands in a shell, the connection is broken after a few minutes of connection.

This happens when we do not interact with the terminal (i.e., we do not type anything on the keyboard).

In such case, the following error message appears:

Solution:

On the host, add those lines in the file ~/.ssh/config in your home directory

If the file config does not exist, just create it.

The ServerAliveInternal pings the server with a null packet every 30 seconds. As for the second line, I have not check whether it is required or not.

This entry was posted in Linux and tagged . Bookmark the permalink.

5 Responses to packet_write_wait: Connection to XXX : Broken pipe

  1. david fournier says:

    Hi,
    Actually what worked for me was to uncomment the following to /etc/ssh/sshd_config:
    (my OS is Ubuntu server 17.10)
    ClientAliveInterval 300
    ClientAliveCountMax 2
    Thanks to https://patrickmn.com/aside/how-to-keep-alive-ssh-sessions/
    David Fournier

  2. Nitin Bansal says:

    Path is ~/.ssh/config i.e., in home directory

  3. Alex Bass says:

    Thank you for this! This fixed it for me.

    I’ve seen the “broken pipe hung up” error loads of times, but the “packet_write_wait” was new for me. This fixed it immediately.

  4. Anonymous says:

    Thanks, this fixed my issue!

Leave a Reply

Your email address will not be published.