Search code examples
linuxsshcentosbroken-pipe

CentOS SSH broken pipe freeze


When I'm connected via SSH to a CentOS box that was recently set up, if I am idle for too long I will become disconnected from the server. There is a long (roughly 30 seconds) freeze of the terminal and then finally I get "Write failed: Broken pipe".

I'm fine with the broken pipe, I have no problem with being disconnected if I'm not active. It is annoying to have to wait for that lag before I get to that point though.

Is there some way to address that delay?


Solution

  • I have tried this in /etc/ssh/ssh_config on Centos: Edit the following settings

    Host *
    ServerAliveInterval 120
    

    This is how often, in seconds, it should send a keepalive message to the server.

    You could set either ServerAliveInterval in /etc/ssh/ssh_config of the client machine or ClientAliveInterval in /etc/ssh/sshd_config of the server machine.

    Try lowering the interval if you keep getting the error