Back To My Mac hostnames with dots in your username
https://marco.org/2010/04/27/back-to-my-mac-hostnames-with-dots-in-your-username
If you have MobileMe, you can access your Back To My Mac-enabled computers via SFTP and SSH (if enabled in Sharing) with this hostname:
computer.username.members.mac.com
…where computer
is the hostname and username
is your MobileMe username (before the “@”).
But if your hostname or username contains a dot or other special character that isn’t normally permitted in DNS, it becomes tricky. You can see how the hostname is encoded by opening Terminal and selecting File→New Remote Connection…, then Secure File Transfer (sftp), then the target hostname under Server, and see how it encodes it on the command line in the bottom text field.1
If your MobileMe username was john.doe@me.com
and your computer was called John's iMac
, it would show this:
sftp -oPort=22 Johns-iMac.john\.doe.members.mac.com.
The backslash isn’t a valid DNS character. Leaving it in, double-escaping it, omitting it, or replacing with a literal period all don’t work for most common commands like ssh
, ping
, or dig
.
Because it’s actually an IPv6 address.
Disclaimer: I know absolutely nothing about IPv6.
So it actually does work with IPv6-enabled commands:
ssh -6 'Johns-iMac.john\.doe.members.mac.com'
ping6 'Johns-iMac.john\.doe.members.mac.com'
If you enable Remote Login (SSH) and set up the SSH connection with password-less keys, you can get your computer’s external IP and avoid the need for DDNS for certain uses (like many of mine).
HOME_IP=`ssh -6 'Johns-iMac.john\.doe.members.mac.com' \
curl -s 'http://whatismyip.org/'`
I’ll be shocked if more than zero people who see this can actually use this information, but it has been eluding me for months and I finally figured it out.
-
Thanks to Cabel Sasser for this tip. His company just released Transmit 4, a ridiculously good file-transfer client. ↩︎