Unable to login after SSH session terminates with Broken pipe

Hi everyone,

I recently started to use Clear Linux and love it thus far.

Currently I am trying to setup SSH to connect from macOS to my Clear Linux (headless) server, including graphics forwarding.
The goal is to use the virt-manager GUI from an SSH session running on macOS.

Initially I had some issues starting an SSH session after configuring Clear Linux as described in the docs:

  • Warning regarding X11 forwarding. Added /etc/ssh/sshd_config as shown below.
  • Warning regarding xauth. Installed xauth (x11-tools bundle) on Clear Linux and added xauth path on macOS.

The problem I am facing now is that after running an SSH session for less than 30 minutes, I get disconnected with a Broken pipe message on macOS:
packet_write_wait: Connection to <ip_addr> port <port>: Broken pipe

Afterwards I try to start a new SSH session from macOS, but this results in a timeout:

$ ssh -X -v <user>@<ip_addr> -p <port>
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/<user>/.ssh/config
debug1: /Users/<user>/.ssh/config line 8: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to <ip_addr> [<ip_addr>] port <port>.
debug1: connect to address <ip_addr> port <port>: Operation timed out
ssh: connect to host <ip_addr> port <port>: Operation timed out

I checked sudo iptables -L, but there are no entries listed.
Similarly, there are no entries for sudo ipset list tallow.

Clear Linux has the following configuration (/etc/ssh/sshd_config):

AllowTcpForwarding yes
X11UseLocalhost yes
X11DisplayOffset 10
X11Forwarding yes

macOS has the following configuration (~/.ssh/config):

Host *
  XAuthLocation /opt/X11/bin/xauth

Any idea what goes wrong here and why I am logged out?
I would love to hear your suggestions and/or improvements regarding this setup.

Have you tried setting ClientAliveInterval

# etc/ssh/sshd_config
ClientAliveInterval 300
ClientAliveMax 2

Or on the client

# ~/.ssh/config
Host *
    ServerAliveInterval 300
    ServerAliveCountMax 2
4 Likes

@inmanturbo thank you for your reply. This indeed fixed the issue.
I read man sshd more thoroughly and found the settings.

1 Like