# Step 1: Set priveleges | |
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all | |
Starting... | |
Setting allow all users to YES. | |
Setting all users privileges to 1073742079. | |
Done. | |
# Step 2: Allow VNC clients | |
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy yes | |
Starting... | |
Set the client options. | |
Done. | |
# Step 3: Set VNC password (change it at the end of the line (i.e. don't use supersecret)) | |
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvncpw -vncpw supersecret | |
Starting... | |
Set the client options. | |
Done. | |
# Step 4: Restart service | |
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent -console | |
Starting... | |
Stopped ARD Agent. | |
Stopped VNC Privilege Proxy | |
Stopped RFB Register MDNS | |
Done. | |
# Step 5: If no ARD services have been activated on the machine before, it is also necessary to run the following command | |
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate | |
Starting... | |
Activated Remote Management. | |
Done. |
This comment has been minimized.
This comment has been minimized.
Super useful. |
This comment has been minimized.
This comment has been minimized.
Super useful indeed. I was able to use this to log into a Circle CI instance to debug an issue via reverse ssh. Wouldn't have been able to figure out what was going on without this. Thanks. |
This comment has been minimized.
This comment has been minimized.
Warning: macos 10.14 and later only allows control if Screen Sharing is enabled through System Preferences. so sad |
This comment has been minimized.
This comment has been minimized.
works well on 10.13.6, thanks |
This comment has been minimized.
This comment has been minimized.
10.13.6, 10.14 - Does not work. |
This comment has been minimized.
This comment has been minimized.
I'm currently working remote exclusively (Covid-19) and this saved me a trip to the office. (OS X 10.14.6) |
This comment has been minimized.
This comment has been minimized.
Thanks for the note @aserraric! Glad to hear it was helpful. |
This comment has been minimized.
This comment has been minimized.
I tested on 10.15.4. For whatever reason, -setvncpw -vncpw password seems to be setting the password to something else coz the vncviewer is getting authentication failure |
This comment has been minimized.
This comment has been minimized.
Yup. You can enable/disable VNC from CLI but NOT set password. This may have started in Mojave possibly, but definitely However, the VNC password (hash) set from the Sharing pane GUI is stored in a (root-owned) pref file in /Library/Preferences. This file can be managed via scripts if you have admin rights and are creative with SSH and scripting, and/or have a Mac management system such as Jamf etc. Edit: typos. |
This comment has been minimized.
This comment has been minimized.
Hi, I'm currently testing the 10.15.4 as well. Indeed the change of the vnc password doesn't work on the command line.
Do you have any idea why? |
This comment has been minimized.
This comment has been minimized.
I dont know. Sorry. |
This comment has been minimized.
This comment has been minimized.
you can add below to your script perl -we 'BEGIN { @k = unpack "C*", pack "H*", "1734516E8BA8C5E2FF1C39567390ADCA"}; $_ = <>; chomp; s/^(.{8})./$1/; @p = unpack "C", $; foreach (@k) { printf "%02X", $ ^ (shift @p || 0) }; print " "' | sudo tee /Library/Preferences/com.apple.VNCSettings.txt") |
This comment has been minimized.
This comment has been minimized.
you can add below to your script perl -we 'BEGIN { @k = unpack "C*", pack "H*", "1734516E8BA8C5E2FF1C39567390ADCA"}; $_ = <>; chomp; s/^(.{8})./$1/; @p = unpack "C", $; foreach (@k) { printf "%02X", $ ^ (shift @p || 0) }; print " "' | sudo tee /Library/Preferences/com.apple.VNCSettings.txt") |
This comment has been minimized.
This comment has been minimized.
All this is nice but ... how do you solve the I'm actually doing ssh to a Mac mini hosted on AWS EC2 ... |
This comment has been minimized.
This comment has been minimized.
This video https://www.youtube.com/watch?v=FtU2_bBfSgM and this gist explain that nicely: https://gist.github.com/sebsto/6af5bf3acaf25c00dd938c3bbe722cc1 |
This comment has been minimized.
This comment has been minimized.
do we need to be in the same network? |
This comment has been minimized.
This comment has been minimized.
@nateware you just saved my day (20.5hrs) endpoint details are - IP, Username, Pass |
This comment has been minimized.
Thanks a bunch for this. My headless Mac Pro was showing a grey screen via Screen Share and it came right back after running these commands.