Enable SMB sharing from command line On OS X 10.8, using terminal commands, I'd like to enable SMB sharing as if I had ticked the following checkbox under System Preferences - Sharing - File Sharing - Options:



I've tried the following command:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist

But despite the smb daemon seeming to be up and running, the checkbox is still unchecked, as if something is missing.

The same command works, as an example, for screen sharing (com.apple.screensharing.plist) and even for AFP (com.apple.AppleFileServer.plist), only SMB seem to suffer from this problem.
I've found the solution. Two commands are needed in sequence:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist EnabledServices -array disk