Mac OS X will only upload zero-byte files through FTP
Posted
by
tabacitu
on Super User
See other posts from Super User
or by tabacitu
Published on 2012-03-25T19:49:33Z
Indexed on
2012/06/20
15:20 UTC
Read the original article
Hit count: 227
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.
Later edit: Solved!
Ok, turns out the problem goes away when I take out my router and connect directly through PPPoE. So the problem is with the router, I thought. 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.
My router's was 1492, which is ok, but my Mac's MTU was 1500, which is unacceptable. I don't even understand why it works directly with PPPoE.
Anyway, if you encounter the same problem, this is how you diagnose and fix it:
In terminal, run:
ifconfig | grep mtu
to see what the MTU is for en0 (or en1, mine was en0)
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
© Super User or respective owner