Monday, October 1, 2012

Remote Desktop to a mac from Windows

Summary: OS X has remote desktop built in (it's called VNC), you just have to set it up and then get a 3rd-party client to run on the Windows system. However, there seems to (as usual) be restrictions on how it works for the exact release of OS X that we're running on the MacBook.

There are several blogs and forum threads that recommend running TightVNC:

http://www.trickyways.com/2010/06/how-to-remotely-access-mac-from-pc/

TightVNC comes from here:

http://www.tightvnc.com/download.php

The problem that I encountered once I got everything set up has lots of Google hits.
I could make the connection to the remote mac, but then nothing would happen. Apparently there is something wrong with how our particular version of OS X implemented VNC, and remote logins require that no other users be logged in, including on the actual machine. Most people complaining about this problem had their VNC working prior to upgrading to OS X Lion and found that it was broken as a result:

http://help.edovia.com/kb/screens/screens-for-ios-and-os-x-lion

https://discussions.apple.com/thread/3190260?start=120&tstart=0

The quick workaround for me is simply to log out of my active session on the Mac and let the remote session be the only login. Apparently another app called RealVNC is also supposed to fix the problem, although I never got around to trying it.

http://www.realvnc.com/products/vnc/

Update: I gave TightVNC and RealVNC a spin using the above hints and it went pretty well. RealVNC still required that no other logins be active on the machine, so that didn't "fix" that problem. It has taken me a while to work out some kinks though with using VNC. The two biggest problems were that over my pathetic DSL at home the connection is agonizingly slow, and the problem of VNC only working if there are not other logins.

I found a bunch of hints to deal with the slowness. Primarily, I have to use TightVNC, which has the highest level of compression. It turns out that VNC is a surprisingly primitive system compared to something like X or Remote Desktop. It apparently ships desktop screenshots whole between the two machines (at whatever is the highest rate possible for the connection), compressing them as .jpegs and using further compression on the data channel. So, the best suggestion that I found was to set the desktop image to a plain color; given the above mechanism it is easy to see why this would help.

The following link had a bunch of suggestions for what to do about the slowness. The most interesting suggestion was to try to use "Remote Assistance", but that sounds like something that I don't have the administrative privs to do on my work mac. The same problem exists with other alternate software which requires installing a server on the mac. Lastly, apparently there's something called "UltraVNC" that is similar to the two clients that I have been using, but I've also seen negative reviews for it elsewhere:

http://superuser.com/questions/285250/vnc-on-windows-why-is-it-so-slow

Here is another great list of suggestions, most of which are for alternate VNC servers. Logmein is mentioned here as well:

http://superuser.com/questions/15337/how-can-i-make-vnc-faster

Here is the link where changing the desktop image was suggested. The comments here have other nice alternative software suggestions as well, inclulding Timbuktu:

http://hints.macworld.com/article.php?story=20050915061927686

Here's where it is revealed that with OS X you can't use the trick of setting the color resolution to 256 to speed up the VNC connection; the built in mac VNC server simply doesn't support this option and fails silently. The alternative sofware suggestions in this thread include VineServer and TeamViewer also mentioned in earlier links:

http://superuser.com/questions/28546/fast-vnc-from-windows-to-mac

Now, the problem with having to have the mac clear of other logins before the VNC connection can be made has been particularly troublesome because TightVNC occasionally just crashes, leaving my login intact on the mac but now no way to get in remotely. After a bit of searching, I found that it is possible to configure a user login on the mac to log out automatically if idle. It seems to be working; I have at least intentionally killed the TightVNC connection without logging out, and after the timeout period I connected back up to find the login prompt awaiting me. To my surprise, I also found the IDL program that was running at the time to be still up; I'm not sure how that worked.

Here's a nice tutorial on how to set up auto-logout:

http://www.ehow.com/how_4577940_set-mac-log-out-automatically.html

Too bad my screens didn't look like those in the above tutorial. The missing piece was probably a result of differences in OS X revision. It turns out that my system has a "lock" icon that I had to click to get to the "Advanced Features" screen:

http://support.apple.com/kb/PH4014?viewlocale=en_US

BTW, here are a few more links about how much Apple sucks for breaking VNC:

https://groups.google.com/forum/?fromgroups#!topic/macenterprise/UqUflFr3icg
http://apple.stackexchange.com/questions/54001/several-users-simultaneously-on-a-mac-mini