Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running ssh on a recently installed Debian squeeze server and every 2 minutes of inactivity i get kicked out from the server with the following message:

Write failed: Broken pipe

I tried changing the settings on /etc/ssh/ssh_config with no avail:

ServerAliveInterval 120 (i tried different values here)


/etc/init.d/ssh restart

I do not want to modify anything client-side and also keep my server secure.

share|improve this question
up vote 3 down vote accepted

I post here the solution in case anybody else has the same problem in the future:

As UtahJarhead pointed, the problem was not coming from ssh but from some kind of network interference. After digging into logs and doing some checks i realized that the server network interface configuration from the box was using DHCP, which was renewing the IP every n seconds, and causing my ssh connection to drop.

Solution: Change my network interface to static and done !

share|improve this answer
Just as a note: DHCP leases get renewed when half the lease time is up. (sort of 'Hey. I got this IP from you. Can I keep using it a bit longer?'). However the usual time for a DHCP lease in in the order of days. If it refreshed every 2 minutes then either something is broken, or the DHCP server is configured with an insanely low lease time (which should be fixed). – Hennes Sep 8 '13 at 14:45
@Hennes, you are right, that could be fixed too. In my case changing the network interface to static was the best solution because it is a remote hosting that has its own static IP, i rather configure it that way for obvious reasons, but as you pointed, the DHCP lease can be configured and that would probably fix it too, thanks for your comment. – spacebiker Aug 30 '14 at 13:59

Your ssh connection is failing. This could be due to packet loss, bad hardware, something else sucking up the bandwidth, anything. I've seen it on a low-end NIC in a laptop of mine. It would pop up, I'd resume the transfer (rsync over ssh) and then it would be fine. However, it's not ssh and modifying sshd_config more than likely won't grant you any reprieve from this issue. Look to your PC or the network itself.

share|improve this answer
The fact is that i used to connect normally with my computer (mac) to my old server, now after the server reinstallation to debian squeeze server i keep getting kicked. – spacebiker Oct 2 '12 at 12:35
Your connection is still failing for whatever reason. ssh opens a pipe. Interference breaks that pipe. It could be a firewall. It could be an internal firewall. It could be iptables. It could be hardware. The fact that it WAS working properly prior to an OS reinstall does lend credence to it not being a hardware failure, but I wouldn't write it off. In either case, I wouldn't look too hard at ssh being the issue. Possible, but I doubt it. – UtahJarhead Oct 2 '12 at 12:55
I think you are pointing me on the right direction, additionally i get thrown by the ftp session too quick, This is what i get from the FTP disconnection; [code]Error: Could not read from socket: ETIMEDOUT - Connection attempt timed out Error: Disconnected from server[/code] Does it tell you something ? – spacebiker Oct 2 '12 at 12:58
Are you getting tossed form ftp or sftp? – UtahJarhead Oct 2 '12 at 13:16
ftp, server-side pureftp and client-side filezilla – spacebiker Oct 2 '12 at 13:23

I had a similar issue after a couple of days of research and capture.

The IP address used for this server was also mistakenly provided for use by a different test device in the network (in my case it was for an F5 self IP). I troubleshot by checking the MAC address reported in the server log message.



Recommended Actions

Detail Data

When I checked the MAC address, I found the address to be the MAC address of the TEST F5. As soon as I took the F5 out of network, this fixed the issue.

share|improve this answer

On the server (sshd) you need to set echo "ClientAliveInterval 60" | sudo tee -a /etc/ssh/sshd_config

share|improve this answer
sorry, i didn't say but ClientAliveInterval was set to 30, it didn't work either – spacebiker Oct 2 '12 at 12:33
I don't recommend this as if you have a 'Match' block at the end of your sshd_config, you could do some ugly things you weren't intending to do. Modify it manually to make sure it neither conflicts nor gets put into a place that's less-than-productive. ;) – UtahJarhead Oct 2 '12 at 12:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .