-
Notifications
You must be signed in to change notification settings - Fork 180
Sharing Services in System Preferences
Basic format to turn on a sharing agent is:
sudo launchctl load -w /System/Library/LaunchDaemons/[Service PLIST File]
Basic format to turn off a sharing agent is:
sudo launchctl unload -w /System/Library/LaunchDaemons/[Service PLIST File]
Note: The System Preferences Sharing Pane GUI will not update to reflect the current state when using the command line to override these settings.
Examples:
File Sharing (AFP)
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
File Sharing (SMB)
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.smbd.plist
Screen Sharing
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
DVD sharing
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.ODSAgent.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ODSAgent.plist
Sharing Services that Don't Follow Standard Format:
Remote Login
systemsetup -f setremotelogin on
systemsetup -f setremotelogin off
(-f flag is to suppress the "are you sure?" prompt.)
Remote Apple Events
systemsetup setremoteappleevents on
systemsetup setremoteappleevents off