如果较真的话,10.12及之前版本思路是这样的:
将/System/Library/LaunchDaemons/ftp.plist中的Disabled一项改为False(0),这样设置FTP服务可用;如果不重启 macOS系统,还需要手动启动它。
使用命令行是最方便的:
- 读取该文件的内容:
sudo defaults read /System/Library/LaunchDaemons/ftp.plist - 设置ftp服务可用(Disabled=False):
sudo defaults write /System/Library/LaunchDaemons/ftp.plist Disabled -bool False - 设置ftp服务禁用(Disabled=True):
sudo defaults write /System/Library/LaunchDaemons/ftp.plist Disabled -bool True - 启动ftp服务:
sudo launchctl load /System/Library/LaunchDaemons/ftp.plist - 停止ftp服务:
sudo launchctl unload /System/Library/LaunchDaemons/ftp.plist
测试依然是:
ftp localhost
而10.13已经不支持ftp了。