MacOS Screen Sharing over the Internet using SSH

May 11, 2009 by dmacnet

You don’t need to subscribe to MobileMe to access a Mac desktop remotely over the Internet from another Mac (”Back to My Mac”). You just need to do some setup. This description assumes (for simplicity) that you’re using Leopard (MacOS 10.5) on both Macs. If you’re still on Tiger (10.4) you’ll need a third-party VNC client like Chicken of the VNC; I haven’t tested that.

This setup runs the Apple Screen Sharing through an encrypted tunnel using SSH, for security.

  1. One-time setup on the Mac you’ll be connecting to, which we will call the “remote Mac”. In System Preferences>Sharing, turn on Remote Login (aka SSH). In System Preferences>Sharing, turn on Screen Sharing, and in Computer Settings, select “VNC viewers may control screen with password:”. Choose a password.
  2. One-time setup on the Internet router/firewall for the network your remote Mac is on. Forward TCP port 22 (SSH) from the Internet to your remote Mac’s internal/private IP address. You might find this option under something like “NAT Rules” on your firewall’s setup screens, which are web pages for most routers. If you haven’t assigned the remote Mac a static IP address, you might want to. Otherwise, find out the IP address that your router assigned it by looking in System Preferences>Network.
  3. One-time setup of a host name for your remote Mac’s Internet connection. It’s convenient to give your your firewall’s external IP address a host name, especially if its IP address is dynamically assigned by DHCP and subject to change without notice. The free service DynDNS.com allows you to create an account and choose a host name for your Internet connection in any of several domain names they control. To keep the DynDNS.com entry for your connection updated, you can use a free little program on your Mac called DynDNS Updater.
    With a free DynDNS.com account, if your IP address doesn’t change for a month (so the updater doesn’t send any updates), DynDNS.com will send you an email saying your registration will expire unless you click on a link in the email to keep it running, so you’ll have to do that once a month.
  4. One-time setup on your local Mac that you’ll be using to connect to the remote Mac. Allow Screen Sharing to connect to 127.0.0.1 (aka localhost); in Terminal run (all on one line):

    sudo defaults write com.apple.ScreenSharing skipLocalAddressCheck -boolean YES

    and type your password when prompted.
  5. To access your remote Mac’s desktop over the Internet from the local Mac, in Terminal on your local Mac run (all on one line):

    ssh -N -L 6900:127.0.0.1:5900  your_login_short_name@your.dyndns.host.name

    If it asks if you want to add or trust the host key or something like that, respond yes. That should only happen once.
    When prompted, type the password for your account on the remote Mac.
    (your_login_short_name is the name of your home folder on the remote Mac; it will be lowercase with no spaces.)

    Run the Leopard Screen Sharing client; in Finder:
    Go>Connect to Server (or Command-k)
    In the Server Address box, type:

    vnc://127.0.0.1:6900

    A login box will pop up; enter your_login_short_name and your password for the remote Mac.
    You can click the + to save this address as a favorite for the future.

    Your remote Mac’s desktop should appear!

    In the Screen Sharing preferences, you might want to try the option “Show the screen at full quality (more detailed)” if needed and you have fast Internet connections at both ends.

Disappearing Rainforest Cafes

February 23, 2009 by dmacnet

For years, Bridgette and I thought it would be fun to visit a Rainforest Cafe some day. The stories of animatronic animals and simulated storms sounded like a memorable experience.

When we got married in 2003, the nearest one was about 45 minutes away in congested Tysons Corner, VA. So we put it off for a few years. In 2005, we went to look up their hours and discovered they had closed that location.

Dave&Bridgette with animatronic elephant

The next closest Rainforest Cafe was about an hour away, in Towson, MD, near Baltimore. Finally, in October, 2007, for our anniversary, we got to that location. We got there soon after they opened, so it was almost empty when we were seated, and we had a great time. Every twenty minutes or so, there was a simulated storm and the animatronic animals would panic at the thunder and flashes of light.

Bridgette with a Volcano!

We ordered a towering chocolate cake called a Vocano for dessert, which featured one of the servers hustling out of the kitchen with it, lit sparklers on top, yelling, “Vollllcaaaaaaaanoooo!” It was better than the happy birthday rap you get at a lot of restaurants (to avoid paying performance royalties on the Happy Birthday song, which is still under copyright, BTW).

After lunch there, we went to the aquarium in the Baltimore Inner Harbor.

For Valentines Day, 2009, we thought we’d go back to the Towson Rainforest Cafe and the Inner Harbor. When we looked them up on the web to find out when they opened, we discovered that the Towson Rainforest Cafe had closed a month earlier. The nearest ones are now in New Jersey and Tennessee.

It seems the Rainforest Cafe may be modeled after the world’s rapidly disappearing rainforests a little too realistically.

We did, however, get to the Inner Harbor Cheesecake Factory for dessert. There was a rather long wait, but it was shorter than driving to New Jersey.

MacOS X, with Redundant Slow File Databases!

February 11, 2009 by dmacnet

I have a couple of PowerBook G4 laptops that are now running Leopard. I keep them closed, in sleep mode, most of the time, often for days at a time, as I’m doing most of my work on faster Macs now. When I do open them up to do something, I often find that they are slowed to a crawl by a “find” process madly searching the disk and using most of the CPU power for the next hour or so. Just when I want to use the computer, it’s too busy to be usable.

What’s happening? I discovered that Leopard updates the “locate” database in its weekly cron script. For a computer that’s on most of the time, that generally happens when it’s idle and I’m not around to care if the computer is slow. If it misses that time because the computer wasn’t on, it runs the job as soon as it wakes up. Right when I want to use it.

So, in addition to Spotlight hogging up the computer, Leopard builds a redundant, Unix-style file database, too. Yes, I was involved in writing that stuff for GNU/Linux, but on Macs I almost never want to run “locate”. You’d think Apple would rewrite it as a Spotlight front-end.

On Mac laptops (excuse me, notebooks), I now edit /etc/defaults/periodic.conf and set

weekly_locate_enable=”NO”

On the slower ones, I also turn Spotlight off completely (I think), by running (with sudo) the commands I found in this tip:

launchctl unload /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

I use EasyFind if I really need to find a file. It produces more usable results than Spotlight does, anyway.

Now my laptops have enough spare CPU time for me to use them again. Thanks, Leopard.