archive about

SSH Back to My Mac

How to remotely SSH to your Macs by taking advantage of Back to My Mac.

This just made my day: I realized that I can use Back to My Mac to SSH to any of my Macs.

The easy way.

Just open Terminal.app > Shell > New Remote Connection and click on Secure Shell (ssh). You should see all your Macs connected to your iCloud account.

Terminal.app

The hard way.

Use dns-sd -B _ssh._tcp

$ dns-sd -B _ssh._tcp
Browsing for _ssh._tcp
DATE: ---Thu 06 Mar 2014---
12:14:21.251  ...STARTING...
Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
12:14:21.253  Add        3   0 1234567890.members.btmm.icloud.com. _ssh._tcp.       macmini
12:14:21.253  Add        3   0 1234567890.members.btmm.icloud.com. _ssh._tcp.       mbp
12:14:21.253  Add        3   5 local.               _ssh._tcp.           mbp
12:14:21.253  Add        2   5 local.               _ssh._tcp.           Fivos

Then connect to your Mac using something like ssh user@macmini.1234567890.members.btmm.icloud.com. (I'm not sure if the BTMM account number (ex. 1234567890) is fixed or if it changes over time.)

As expected, once you have SSH access, you can actually do much more, like SSH port forwarding and tunneling.

Even if you don't intend to SSH to your Macs, keep in mind that using Back to My Mac may make your Macs more vulnerable to third party attacks. At least have a look at Apple's security tips.


I found most of the above at Webdiary.com which has a much more detailed post on all this.