MacOS – SSH works locally but not remotely

macbook promacosssh

I have remote login turned on, and when I'm at home, I can access the Mac via SSH just fine, by using the local IP address. However when I try to access it when I'm not at home, using the global IP address, it always times out.

Any ideas? Or am I missing something really obvious here?

Best Answer

If all your machines are running Lion or Mountain Lion, and you're using the same iCloud account on them, then you can use iCloud to ssh as described in this blog post from One Thing Well

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

You can also add this to your ~/.ssh/config to make it easier

Host mac-remote
User username
HostName computername.[account number].members.btmm.icloud.com
AddressFamily inet6
Protocol 2