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

Home / Apple / 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:

12345678.members.btmm.icloud.com

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

ssh -2 -6 remote-hostname.12345678.members.btmm.icloud.com

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

One Comment

  • John

    The first command gives me two icloud.com 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