Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 0 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
add comment

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. –  Xabier Arrabal 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 ? –  Xabier Arrabal 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 –  Xabier Arrabal Oct 2 '12 at 13:23
show 1 more comment

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 –  Xabier Arrabal 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
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.