Enable and access OS X remote desktop through SSH?

6

3

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!

Ishaan

Posted 2010-03-28T23:33:20.420

Reputation:

Answers

3

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.

CaseyIT

Posted 2010-03-28T23:33:20.420

Reputation: 3 213

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 – 2010-03-29T14:10:46.813

And if you have an Apple Screen Sharing client, then no need to allow for plain VNC access. See http://support.apple.com/kb/HT2790 for the command then.

– Arjan – 2010-03-29T14:13:33.690