Is it possible to terminal login remotely (outside local network) to the mac at home via SSH + VPN

remote desktopssh

With enter image description here, I can access my mac at home via VNC.
When in the same network, I also can access it via ssh with the name NAME.local with the help of bonjour.

enter image description here

Then, is it possible to terminal login the mac at home via VNC + SSH or anything? I tried with NAME.local outside local network, but the name is not recognized.

ADDED

ssh computername.`echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p'`

also works fine.

Reference: http://smithjw.me/blog/2012/8/1/initiating-screen-sharing-or-back-to-my-mac-from-the-command.html

Best Answer

Yes, you can use the iCloud Back to My Mac address to SSH/VNC in. You can obtain your address using the following command.

dns-sd -E

The final line shows the account number.
Use the following syntax for determining the address:

computername.number.members.btmm.icloud.com

Providing you have port forwarded correctly, you can use this address to connect over SSH/VNC.