How To Use iCloud To Remotely SSH Into Your Home Mac
One of the driving forces behind the popularity of cloud computing and services like Dropbox and Apple’s iCloud is the level of accessibility that it brings, and in a lot of circumstances it can make day-to-day computing activities a lot simpler than before. Rather than having to make constant backups of information or carrying external hard drives or USB drives around with us, having important data and files stored in the cloud allows us to quickly get access to that information from pretty much wherever we are as long as we have a network connection.
When Apple introduced iCloud to the world, it wasn’t immediately apparent to some people how they would benefit from such a service, but as the fruit company pushed and developed the service, it has grown into something that is pretty much impossible to live without. Having data like photographs, contacts and app data all stored centrally to be pushed across multiple devices and computers is a godsend and something which will only get better as time goes on. Apart from the published and popular features of iCloud, what else can it do for us?
Well, if you happen to be fortunate enough to have more than one Mac running iCloud along withe compatible versions of OS X (Lion or Mountain Lion) then it is also possible to remotely SSH between them thanks to iCloud and its IPv6 network. For the remote connection to be possible, all of the Macs in question need to be signed into the same iCloud account with the Back to My Mac option enabled through the iCloud preferences. To get this remote SSH up and running, follow the simple steps below.
Step 1: The first step is to make sure that Back to My Mac is enabled on all the Macs in question. This is achieved by navigating to System Preferences > iCloud > Back to My Mac.
Step 2: To actually gain an SSH connection to the remote Mac, you will need to know the Back to My Mac account number. Open up an instance of the Terminal application and run the following command: dns-sd -E
Step 3: Once the account number is know, run the following command in Terminal to make an SSH connection to the remote machine: ssh -2 -6 username@computername.[ACCOUNT NUMBER].members.btmm.icloud.com
So there you have it. Using the iCloud network to remotely SSH into another iCloud enabled Mac is relatively simple and only involves typing a few lines from the Terminal app. To complete step 3 every time you want to do this and it might be an issue for some, simply add the following to ~/.ssh/config:
Host mac-remote User username HostName computername.[accountnumber].members.btmm.icloud.com AddressFamily inet6 Protocol 2
Once the above has been completed, you can then replace step 2 with a much simpler string in the Terminal: ssh mac-remote