Advertisement

How to enable the FTP server (ftpd) in Lion

Apple decided to remove the GUI for enabling and disabling FTP from Mac OS X Lion. Generally speaking, that's not a bad move, because most times SFTP is available anywhere FTP is, and SFTP is far superior in terms of security. No one should be using FTP over the Internet.

However, there are some cases when using FTP is perfectly fine. For instance, transferring large files over your own LAN. I do this all the time when transferring DVD rips from one machine to another. Others have mentioned that they have some devices which only support FTP so SFTP isn't an option.

Personally, I prefer FTP on my LAN because, since it is unencrypted, there's no extra processing time needed to encrypt and decrypt the transfer. I'm also willing to admit that there may not be much practical difference in most cases -- that is, I don't know that SFTP is much slower than FTP, but when you're talking about "8 GB at a time" transfers, every little bit matters.

Enabling FTP on Lion

The good news is that Apple did not remove the FTP server (/usr/libexec/ftpd) from Lion, they only removed the GUI to enable or disable it.

The even better news is that there are (at least) two GUI tools for re-enabling it:

  1. Lion Tweaks (which also lets you toggle other Lion settings)

  2. FTPD Enable App which is an AppleScript app to launch ftpd

For those of us who prefer the command line, there are even instructions on how to enable ftpd using launchd.

ftpd.sh

I wrote a small shell script called ftpd which will let you turn ftpd on or off, or check its current status. Usage is very simple:

  1. ftpd.sh --on

  2. ftpd.sh --off

  3. ftpd.sh

#1 will turn it on, #2 will turn it off, #3 will show you whether it is currently on or off.

My script is based on Daniel Smith's launchd commands mentioned above. The script must be run as root, but if it isn't, it will automatically re-launch itself using 'sudo' rather than failing ungracefully. It is also smart enough not to try to turn it on when it is already on, or off when it is already off.

To use the script, download ftpd.sh and then put it somewhere in your $PATH such as /usr/local/bin and make sure it is executable chmod 755 /path/to/ftpd.sh. (If any part of that previous sentence didn't make sense to you, I recommend using one of the GUI programs listed above. Using the Terminal is one option, but it's not the only option.)

Once again I repeat: if you are trying to connect to another machine over the Internet in an otherwise unencrypted manner, use SFTP. The only time FTP should be used is when there is no chance of the password being 'sniffed' by a nefarious third party.

You can enable SFTP and SSH in Lion (and previous versions of OS X) by going to System Preferences » Sharing and making sure that "Remote Login" is enabled. When in doubt, use SFTP. But if you need FTP and are aware of the risks, now you have the option of enabling it when needed.

ftpd just one time

If you want to enable ftpd immediately without downloading or installing any scripts or apps, simply enter:

sudo launchctl load /System/Library/LaunchDaemons/ftp.plist

into Terminal.app. If you want to turn it off afterwards, enter the command

sudo launchctl unload /System/Library/LaunchDaemons/ftp.plist

All ftpd all the time

If you use any of the above solutions, ftpd will be disabled again when you reboot the computer. If you want to enable ftpd automatically after every reboot, you will need to edit /System/Library/LaunchDaemons/ftp.plist by looking for the lines

Disabled

and changing them to

Enabled

which will tell Lion to enable ftpd on reboot. Use the launchctl load command shown above to enable it without rebooting.

Note: I recommend that you do not edit ftp.plist unless you absolutely cannot avoid it. I am firmly against tinkering with anything in /System/ but at the end of the day, it's your computer, and if if your situation requires ftpd to be available at all times, editing the plist is the best way to make sure it is always on.