Skip to content

Instantly share code, notes, and snippets.

@macsimom
Created March 23, 2021 16:40
Show Gist options
  • Save macsimom/a4e7c7fdab47f1be9ce3e6594e071c64 to your computer and use it in GitHub Desktop.
Save macsimom/a4e7c7fdab47f1be9ce3e6594e071c64 to your computer and use it in GitHub Desktop.
A short script to enable Apple Remote Desktop (aka. Remote Management) for a given user.
#!/bin/zsh
function ENABLEARD(){
dscl . -create "/Users/${1}" dsAttrTypeNative:naprivs -1073741569
touch "/Library/Application Support/Apple/Remote Desktop/RemoteManagement.launchd"
if ! launchctl list|grep -q com.apple.screensharing ; then
launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
fi
echo "Enabled Apple Remote Desktop Management for ${1}"
}
if [ "$(whoami)" != "root" ]; then
echo "You must be root to run this command"
exit 1
fi
if id -u "$1" &>/dev/null ; then
ENABLEARD "$1"
else
echo "${1} is not a valid username"
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment