Last active
December 21, 2021 08:12
-
-
Save epcim/d85a7415e2bc8cf69149ba24b350cd5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# /System/Library/CoreServices/Screen Sharing.app | |
# https://ss64.com/osx/kickstart.html | |
# https://apple.stackexchange.com/questions/30238/how-to-enable-os-x-screen-sharing-vnc-through-ssh | |
SWITCH=${1:-on} | |
[[ "$SWITCH" == "on" ]] && { | |
echo "Enter VNC PASS" | |
read -s VNCPASS | |
export PARAM="-clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw "$VNCPASS" \ | |
-restart -agent -privs -all -users $USER" | |
} || { | |
SWITCH="off" | |
export PARAM="" | |
} | |
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \ | |
-deactivate -configure -access -${SWITCH} ${PARAM} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment