This script will enable the macOS built-in screen sharing for defined users only.
This method no longer works with devices running 10.14+. Please see the following article regarding Screen Sharing on 10.14+
macOS Privacy Preferences Payload in Mojave 10.14+
Attempting to run the below script will yield the following response.
# /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -activate
Warning: macos 10.14 and later only allows control if Screen Sharing is enabled through System Preferences.
Activated Remote Management.
After running the command, System Preferences will show Remote Management enabled, but any attempt to connect to a device will show a black screen.
Enabling ssh may be achieved thus:
launchctl load -w /System/Library/LaunchDaemons/ssh.plist
- FW Admin
- Target macOS client
- Create a new empty fileset.
- Click the script item in the button bar
- Create a new script
- Open the fileset and rename the script to be unique.
Select the .sh file and choose "edit text" to open the script file.
# benm @ filewave
# Feb 2013 - original creation
#Save output to client log
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -specifiedUsers
# For Change USERNAME to the name of the account you wish to enable.
# you must use the short name of the account (the name with no spaces in it)
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -users USERNAME -access -on -privs -all
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -activate
Where USERNAME is the short name of a users.
Use Short Name:
If you add
sudo systemsetup -setremotelogin on
To the script, it will enable ssh login (aka Remote Login).