Saturday, September 5, 2009

Connecting to Mac OS X via VNC

In the entirety of my house, I happen to be the only Windows user (and an Avid one at
that!  Macintosh can suck my Windows 7 Orb!), but for some occasions I too wish I could use the Macintosh. 
For such things as the local web server, and in the future possibly making iPhone applications.

Now,
I don’t like going downstairs to use the best non-laptop Macintosh.  Its hooked up to a High Definition
Projector system, and it is simply a burden to try to get anything code-wise with it done, without either
sitting up close to the screen, or using Apple+ to make it larger, so, I did what any geek would attempt to
do.  Get Apple’s Screen Sharing system working with my Windows Box.

href="http://www.flickr.com/photos/navarr/3875809328/"> alt="Mac vs. PC - Best of both Worlds?" width="500" height="313" />

I have
to be honest with you.  It was a hassle and it was definitely NOT worth it. 
Regardless of client side settings, VNC was incredibly slow over the Local Network.

However,
as some of you may wish to try this yourself, I’ve included the instructions after the break.


Hi
all,

I actually registered on this forum just to post this solution. I hope it will
make many others happy!

Motivation for going through these hoops:
I needed to
access the desktop of an old OSX machine every now and then from a windows VNC client. Details of that
machine are:
Dual G5 OSX 10.4 without monitor/keyboard.

Important:

-
Remote Desktop had never been enabled before on that machine.
- SSH access however was available.

So
how do you turn on Apple Remote Desktop / VNC Server on a machine where it never ran before? That part was
easy to find on the net: SSH as an admin user onto the OSX machine. Then execute this command:

sudo
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure
-access -on -users admin -privs -all -restart -agent

Try to connect with your VNC
client now. If it works, good, you're done. The above command takes care even of restarting the Remote
Desktop Service when the computer is rebooted.

But if you're not so lucky (like I was)
and the connection fails with a message like:
- "Server did not offer supported security type"
(tightVNC)
- "No matching security types" (realVNC)
- "Incompatible Version" (UltraVNC)

you're
stuck. What happened in this case is that the VNC password has never been setup properly. Follow these
simple steps while still logged in as admin user to set up a default password ("pass" in our case):

-
Switch off RDP:
sudo
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -stop

-
Go to the Preferences directory:
cd /Library/Preferences

- edit the following
files using vi (if you're not familiar with vi, be very careful to follow the instructions to the iota!):
sudo
vi com.apple.RemoteManagement.plist

Put the following lines into this file (hint: copy
them from here rather than typing them). Instruction for vi newbies:
- copy the text below into
your clipboard
- set focus to the ssh window
- press the 'i' key. This puts vi into text
insert mode
- paste the text. If you're on windows/cygwin, click to top left of the cygwin ssh
window -> Edit -> Paste
- press the 'Esc' key
- enter the keystrokes
':wq', colon tells vi you are about to enter a command, w is the command for write, q for quit.

ARD_AllLocalUsers

LoadRemoteManagementMenuExtra

ScreenSharingReqPermEnabled

VNCLegacyConnectionsEnabled
-
edit the file sudo vi com.apple.ScreenSharing.launchd
press the 'i' key and type enabled, hit
return, 'Esc' and ':wq'

- set the default VNC password to 'pass' by editing this file:
sudo
vi com.apple.VNCSettings.txt
and copy/paste this string (the encoded password) into that file:
6755221D8BA8C5E2FF1C39567390ADCA

- Now the files need to have their ownerships and
access rights configured properly. Do this by executing the following commands after each other:

sudo
chmod 644 com.apple.RemoteManagement.plist
sudo chown root:admin com.apple.RemoteManagement.plist

sudo
chmod 644 com.apple.ScreenSharing.launchd
sudo chown root:admin com.apple.ScreenSharing.launchd

sudo
chmod 400 com.apple.VNCSettings.txt
sudo chown root:wheel com.apple.VNCSettings.txt

Now
stop and start the Remote Desktop Server, or reboot the machine:

To just restart the
Remote Desktop first stop it:
sudo
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -stop

Then
restart it:
sudo
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure
-access -on -users admin -privs -all -restart -agent

or, alternatively, reboot the
server:

sudo shutdown -r now

Connect to the server and enter your
password we set to "pass" above. Set the password to something else by opening the System Preferences ->
Sharing -> Apple Remote Desktop -> Access Privileges and set the password in the "VNC viewers
may control the screen with password:" to something else.

:apple:ED

Hope
this helped!

Cheers

Balt Indermuehle

(taken
from: http://forums.macrumors.com/archive/index.php/t-380251.html
)

1 comment:

  1. VNC is no doubted, a quality remote support tool. Additionally, one may even consider
    using other remote support tools such as logmeinrescue, gosupportnow, GoToMyPC etc. or deploying on premise
    remote support appliance such as RHUB or Bomgar appliances.

    ReplyDelete