ftpd on OS X

Recorded on May 8th, 2014

A few years ago I wrote about How to enable the FTP server (ftpd) in Lion and the reasons that you might want to do that. Today on Twitter @bradleychambers was asking about it, so I re-shared my ftpd.sh for turning FTP on or off, or just checking its current status.

(If you prefer a GUI for this, FTPD Enable is still available.)

However, I’ve learned a few new tricks since I first wrote it, and so I edited the script to not call itself via sudo but only use sudo for the specific commands that require it, which all have to do with launchctl.

sudoers

If you are only going to use ftpd.sh interactively, then you can just enter your sudo password when necessary. However, if you want to script/automate the process of enabling/disabling FTP, you’ll need to add these lines to your sudoers file using visudo:

%admin ALL=NOPASSWD: /bin/launchctl list
%admin ALL=NOPASSWD: /bin/launchctl load -w /System/Library/LaunchDaemons/ftp.plist
%admin ALL=NOPASSWD: /bin/launchctl unload -w /System/Library/LaunchDaemons/ftp.plist

Barely Tangentially Related

While we are on the subject, there are other good entries for your sudoers:

%admin ALL=NOPASSWD: /bin/launchctl unload /Library/LaunchDaemons/com.adobe.fpsaud.plist

will let you easily turn off Flash’s auto-update if you want, or

%admin ALL=NOPASSWD: /bin/rm /Library/LaunchDaemons/com.adobe.fpsaud.plist

will let you delete it when you forget to say “no” when installing an update.

If you use CrashPlan these two lines will let you easily load/unload the CrashPlan engine, which I do depending on which network I am on:

%admin ALL=NOPASSWD: /bin/launchctl load /Library/LaunchDaemons/com.crashplan.engine.plist
%admin ALL=NOPASSWD: /bin/launchctl unload /Library/LaunchDaemons/com.crashplan.engine.plist

That’s not strictly necessary, since you can tell CrashPlan which Wi-Fi networks to use (or not use) but I prefer having it off when not in use.