SSH connection drops after 2 to 3 hours with write:failed, broken pipe error

Joined
Sep 26, 2007
Messages
23
Reaction score
0
Points
1
Hello everyone

I am using ssh to login to a linux box from my Mac. Please see below some info:

System Version: OS X 10.9.1 (13B42)
Kernel Version: Darwin 13.0.0
Boot Volume: Macintosh HD
Boot Mode: Normal

This is how my ssh_config file looks like:

Host *
SendEnv LANG LC_*
ServerAliveInterval 30
ForwardX11Timeout 1D
# ForwardAgent no
# ForwardX11 no
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
# Protocol 2,1
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com

# XAuthLocation added by XQuartz (http://xquartz.macosforge.org)
Host *
XAuthLocation /opt/X11/bin/xauth
ServerAliveInterval 30

Is there anything else I need to add to it?

The serverAliveInterval is set to 30 which means that every 30 seconds my mac is sending null packets to the remote machine in order to keep the connection alive. Why it drops after a few hours is a mystery to me.
The error I get is:

Write failed: Broken Pipe.

If anyone has any suggestions please let me know.

Many thanks.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Is it the server timing out? It's possible that the error is actually on the other side. How is SSH configured on the Linux box?
 
OP
G
Joined
Sep 26, 2007
Messages
23
Reaction score
0
Points
1
Hello

I have another ssh connection from another mac to the same server for more than a day and it is still alive. So I don't think is the server side. Other mac users are connecting to the same server with no problems. :\
However please see below the sshd_config on the server:

Code:
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
Protocol 2

AcceptEnv LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 
AcceptEnv LC_IDENTIFICATION LC_ALL

TCPKeepAlive yes
X11Forwarding yes
ClientAliveInterval 30
ClientAliveCountMax 99999
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Although I'm not confident that this is a configuration issue, have you tried copying a ssh_config from a working machine to this Mac?
 
OP
G
Joined
Sep 26, 2007
Messages
23
Reaction score
0
Points
1
Thanks cradom

I did come across the link you posted but didn't make any difference for me.
I will try copying an ssh_config from the working mac to the "problematic" one as suggested and see if it makes a difference. The user at the moment is sshing to another server and from there logs in (ssh) to the server that drops the connection after a while.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top