Remote SSH using Back To My Mac
If you have more than one Mac running OS X Lion and you’re signed in to the same iCloud account on all of them, you can SSH between them via iCloud’s IPv6 network.
First, find your Back To My Mac account number by running
dns-sd -E
Then SSH to another machine like so
ssh -2 -6 username@computer-name.[account number].members.btmm.icloud.com
That’s hard to remember and a hassle to type, so might want to add something like the following to your ~/.ssh/config:
Host mac-remote
User username
HostName computername.123456789.members.btmm.icloud.com
AddressFamily inet6
Protocol 2
Which means you can just type
ssh mac-remote
to log in to your other Mac when you’re out and about.
Very handy.
Update 24/07/2012
Reader TJ wrote in to say:
If you don’t want to hard code your Back To My Mac address into your .ssh/config you can get it dynamically using this line:
echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p'