I forgot to turn on "VNC viewers may control screen with password", to enter on my working Mac, is there way to turn-on this feature remotely via SSH (I'm on WindowsXP now)?
2 Answers
Source: (archived)http://technotes.twosmallcoins.com/?p=279
Putty is a good SSH client for Windows.
SSH into your remote OS X machine with an administrator’s log in and password.
Enable Remote Desktop (a.k.a. Screen Sharing, a.k.a. VNC) with this command:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \ -activate -configure -access -on \ -clientopts -setvnclegacy -vnclegacy yes \ -clientopts -setvncpw -vncpw mypasswd \ -restart -agent -privs -all
Login using a VNC client. As I mentioned, TightVNC worked for me; for some reason, RealVNC and UltraVNC didn’t. Your password is “mypasswd” (see the -vncpw flag in the above command; you can and should change this).
When you are done, turn off screen-sharing using your SSH session:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \ -deactivate -configure -access -off
-
2Amazing! Works!– StNickolayCommented Nov 4, 2011 at 22:43
-
3
-
1Warning: this breaks with the "Remote Desktop Client Update v3.8.5" update. See here: discussions.apple.com/thread/7501620?start=15&tstart=0– shrxCommented Mar 28, 2016 at 23:38
-
1@Novellizator Both Mac and Linux have ssh available out of the box. No need for a separate package like you need on Windows. Commented Jul 15, 2016 at 0:40
-
6Warning: macos 10.14 and later only allows control if Screen Sharing is enabled through System Preferences. Commented Feb 19, 2019 at 10:55
Here is a different way, that enables screen sharing access for all current users, instead of using a single VNC password:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
-activate -configure -access -on \
-configure -allowAccessFor -allUsers \
-configure -restart -agent -privs -all
Disable it with this:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off
This allows you to connect to the remote computer from a mac using the share screen
button in Finder.
Reference: http://ss64.com/osx/kickstart.html
-
2For posterity: if you do this, you can also connect via
/System/Library/CoreServices/Screen Sharing.app
.– DanicaCommented May 27, 2013 at 20:50 -
1Note that you can (very) easily launch the Screen Sharing app using a Spotlight search Commented Nov 7, 2016 at 22:05
-
1
-
15Got this response on macOS Mojave: "Warning: macos 10.14 and later only allows control if Screen Sharing is enabled through System Preferences."– toraluxCommented Aug 15, 2019 at 8:26
-
2Not working for me on 10.15.7. Once this command is run, you can connect with Screen Sharing, but the screen is black. By contrast, turning it on with the System Preferences app, you don't get that issue. Commented Jun 30, 2021 at 8:57