Enable and access OS X remote desktop through SSH?

5,528

On your Mac at home:

If you have set the VNC password on your home Mac ... copy the contents of the file below:

/Library/Preferences/com.apple.VNCSettings.txt 

If you haven't set VNC password at home, go to

System Prefs->Sharing->Computer Settings

and set password then copy the string from the file as above.

On remote machine:

sudo emacs /Library/Preferences/com.apple.VNCSettings.txt 

Copy and paste the contents of com.apple.VNCSettings.txt from the home Mac to that .txt file on the remote Mac

Then try sending this command over ssh to the remote Mac:

   sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientops -setvnclegacy -vnclegacy yes

A VNC connection should work now between home and the remote site.

Share:
5,528

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin over 1 year

    I'm on vacation and need to run a GUI program on my Mac at home. I can get to a console through SSH, but otherwise the machine is behind a firewall. How can I...

    1. Enable VNC from the command line
    2. Tunnel that through SSH to my MacBook

    Thanks!

  • Arjan
    Arjan about 14 years
    Assuming it works: nice! As the SSH security may be good enough, I guess any password for plain VNC will do. So, to use "welcome", use this as the contents of that file: 60513D0DE4C5A0E2FF1C39567390ADCA. (That is: this works for my Snow Leopard Mac. No newline in that file.)
  • Arjan
    Arjan about 14 years
    And if you have an Apple Screen Sharing client, then no need to allow for plain VNC access. See support.apple.com/kb/HT2790 for the command then.
  • Tomeamis
    Tomeamis over 3 years
    Since edits must be at least 6 chars, I'm putting this here: In the last command there is a typo. -clientops should be -clientopts