I'm using Mac OS X Lion and I've been having this problem with FTP (any FTP client, mind you. I tried Transmit, FileZilla, Cyberduck and the Terminal, all with the same result)

I can browse files in my FTP Client, but when I upload files, the client hangs for a few seconds, then thinks it uploaded the files successfully, but it only creates a new file with one blank line in it. Sometimes, it manages to upload 4-5 lines.

It then returns:

226 - Error during read from data connection
226 Transfer aborted

But 2xx is a success message. It is not a server issue, since any Windows machine will upload just fine using the same network. Can anybody figure out what the problem is? It renders my Mac useless for web development.

The problem persists with SFTP and FTP with SSL/TLS.

migrated from stackoverflow.com Mar 25 '12 at 20:23

This question came from our site for professional and enthusiast programmers.


The problem goes away when you take the router and connect directly through PPPoE.

At first blush the problem is with the router. But no, the problem is with the Mac that connects through a router that connects through a PPPoE and tries to upload using FTP. Pretty specific, I know.

The problem is with the MTU (maximum transmission unit). Apparently, Mac OS X breaks the file into chunks that are too large for the router to send, because the router's MTU was set lower than Mac OS X's.

The router here was 1492, which is okay, but where the Mac's MTU is 1500, this is unacceptable. Don't really understand why it works directly with PPPoE.

If you encounter the same problem, this is how you diagnose and fix it:

In terminal, run the following to see what the MTU is for en0 (or en1, mine was en0):

ifconfig | grep mtu

If it's 1500, run

sudo ifconfig en0 mtu 1300

This should solve it.

If so, it may only be until the next restart. You can also change the MTU in System Preferences \ Network \ Ethernet -> Advanced \ Hardware

Later edit:

One-line fix (if you want to use it as an Alfred Extension or run it at startup, replace with your sudo password):

echo <password> | sudo -S ifconfig en0 mtu 1300;

protected by Community Jul 12 '12 at 4:25

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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