Terminal Tips: More reliable SSH connections to your Back to My Mac hosts

Sponsored Links

Terminal Tips: More reliable SSH connections to your Back to My Mac hosts

Back to My Mac is a feature of MobileMe that allows you to connect remotely to your Macs. Usually this is for screen-sharing or file-sharing through the Finder, but you can also connect via SSH.

In the Terminal app (found in /Applications/Utilities/), you can connect via Shell » New Remote Connection, then click the "Secure Shell (SSH)" item, then the computer you want to connect to under the "Server" column.

But what if that doesn't work? In that case, I have two suggestions for you: first, use SSH v2 and IPv6. Perhaps it's best to show you the command and then explain it:

ssh -2 -6 imac.luomat.members.mac.com -v

The "members.mac.com" is consistent for all users. "luomat" is my MobileMe username. "imac" is the hostname of my Mac. See System Preferences » Sharing if you don't know what your computer's name is, or to change it.

The "-2" tells SSH to only try SSH protocol version 2, and the "-6" tells SSH to only use IPv6 addresses. The "-v" tells SSH to be "a little" verbose in its output. That part is optional. You could also use -vv or -vvv if you want more verbosity.

So far, this method has given me even more success than my DynDNS hostname, which I described before. Before you worry about the security implications of giving people my MobileMe hostname, I should mention that it seems to be impossible to connect to BTMM hostnames unless you are connecting from another computer that is logged into that same MobileMe account.

If you have spaces in the computer's name, they are usually replaced with "-" and punctuation is ignored. So, "John's iMac" becomes "Johns-iMac" in the SSH command. Marco Arment also figured out that if you have a period in the hostname or MobileMe username, you should escape it with a \ so that "john.doe" becomes "john\.doe" when you are connecting via SSH.

Of course, to be able to connect to your remote Mac via SSH, you must have enabled "Remote Login" under System Preferences » Sharing.

All products recommended by Engadget are selected by our editorial team, independent of our parent company. Some of our stories include affiliate links. If you buy something through one of these links, we may earn an affiliate commission.
Popular on Engadget