Le Nguyen The Dat bio photo

Le Nguyen The Dat

~ Data Science & Engineering

Twitter Facebook LinkedIn Github
There are a couple of ways that let you remote-connect to your mac from anywhere.

If you are using 2 different macs, a nice and easy way is enable "Back to My Mac" from iCloud, which allow you to either transferring files or using screen sharing function:


 


Also, remember to enable Screen Sharing from your Preferences -> Sharing window:


 



Next, go to your Finder, look at Shared, select your machines and click "Share Screen..."


 


What if you don't have another mac? It's possible for you to SSH into your own mac from anywhere:

First, enable Remote Login from your Preferences -> Sharing window:
  Next, in your terminal, find your iCloud account number by typing in:


 dns-sd -E  

the result should looks like this:



 $ dns-sd -E
Looking for recommended registration domains:
DATE: ---Thu 23 May 2013---
12:59:06.005 ...STARTING...
Timestamp Recommended Registration domain
12:59:06.006 Added (More) local
12:59:06.006 Added icloud.com
- > btmm
- - > members
- - - > 123456789


(The last number is your iCloud's account number: 123456789) Now you can ssh into your mac:



 ssh username@computer-name.[account number].members.btmm.icloud.com 

If you are too tired of typing all those out, it's always easier to put them into your ssh config file (~/.ssh/config)



 Host [your Host]
User [your Username]
Hostname [your Hostname: computer-name.[account number].members.btmm.icloud.com]
IdentityFile [private key location] (if needed)


There you go, now you can connect to your mac just by typing:

 ssh [your Host]
That's it, have fun and thanks for reading :).