MacOS – Yosemite as ftp server

ftpmacos

I have many problems with my Mac OS X. The system is only reachable via SSH, but not with FTP and not with SMB.
So I tried to concentrate on FTP, seems easier to debug and may be it's one problem for both services.

First I enabled ftpd with:

sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist

Then I try to ftp. But nothing. I got the standard error: Operation timed out.

After that I tried it again and made a tcpdump on the MBP. Looks fine for me:

tdmacpro:~ root# tcpdump port 21
tcpdump: data link type PKTAP
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on pktap, link-type PKTAP (Packet Tap), capture size 65535 bytes
17:32:53.539323 IP 192.168.0.58.49191 > 192.168.0.2.ftp: Flags [S], seq    2091779555, win 65535, options [mss 1460,nop,wscale 3,nop,nop,TS val 271391148 ecr 0,sackOK,eol], length 0

So the packets are reaching the MBP, but it did not answer.

After that I created a new virtual machine on my MBP to be sure that no switch makes any problem. Then the ftp client was in my virt. machine. But same error.

After that I tried a ftp user@MBP_IP, again same error.

After that I disabled fptd with

sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist

and started the ftpd manually with

/usr/libexec/ftpd -d -D -l -U

again the same problem.

Then I used another terminal and made a:

ftp localhost

This works. So I think the ftpd is configured properly. But I also controlled the ftp.plist with a new installation.
The same content.

So is there anybody out there who has any further suggestions how to isolate the problem or how to solve it?

Best Answer

Have you checked that it listening on the correct network interface? If connecting to localhost:21 works, but connecting to your LAN IP does not, it's likely just a misconfiguration. You can confirm with something like this:

$ netstat -an | grep LISTEN
tcp4       0      0  *.21                *.*                    LISTEN

You want to see *.21 or 0.0.0.0.21 or 192.168.0.x.21.

If you see ::1.21 or 127.0.0.1.21 then it's only listening on the localhost interface and won't be reachable from other systems.

I couldn't reproduce your problem on my Yosemite system; when I ran ftpd with the arguments you provided, it correctly listened on all interfaces (*.21).