SSH to your remote machine using Back to My Mac iCloud Service

This is kinda cool. It only works if you have access to “Back to My Mac” service and you have it turned on in the remote mac’s preferences (under iCloud preferences). If you ever need to find out the FQDN (Fully Qualified Domain Name) of your remote mac and connect to it via ssh or something like it you can use the following command in the terminal:

echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p'

This should spit out the “domain name” for your “personal” iCloud DNS. The output looks something like this:

To use this in a ssh command you would need the name of the remote machine plus the information above:

ssh -2 -6

That’s it… should see a prompt for ssh login to your remote machine.

, , , , , ,

One response to “SSH to your remote machine using Back to My Mac iCloud Service”

  1. The first command gives me two lines with different numbers in the front. I’m wondering what each is.

    Also, how do we find the remote-hostname. I assume this is referring to a hostname, but my mac has an internal hostname. Not sure what name it has externally to icloud.

Leave a Reply