FTP server on MacOS X Lion

       123 words, 1 minutes

Can’t remember why, but I needed to transfer files from my MacBook using FTP. There is no way to enable FTP from the System Preferences. But you can enable/disable it from the console:

# sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist
# netstat -na | grep LISTEN
tcp6       0      0  *.21                   *.*                    LISTEN     
tcp4       0      0  *.21                   *.*                    LISTEN     
(...)

Once enabled, you can log in using the usual user account.
To disable the daemon, simply:

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

Indeed, the best solution is to use FTP over SSH. Click the “Sharing” button in the “System Preferences”. Select “Remote Login” and allow the access for some or all users. Now, you can use sftp to transfer files in a safer way.