Information
By disabling file sharing, the remote attack surface and risk of unauthorized access to files stored on the system is reduced.
Solution
Perform the following to implement the prescribed state:
Run the following command in Terminal to turn off AFP from the command line:
sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
Run the following command in Terminal to turn off SMB sharing from the CLI:
sudo defaults delete /Library/Preferences/SystemConfiguration/com.apple.smb.server EnabledServices
sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.smbd.plist