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?

  • 1
    How is the computer attached to the internet and what is the global IP address - that is where is that defined - is it the router's address?
    – mmmmmm
    Jun 15, 2013 at 7:58
  • It's connected via WiFi. And yes it is.
    – Tamara
    Jun 15, 2013 at 8:17
  • 2
    I assume you are using a router/DSL thingy to access the internet. Did you configure the router to forward SSH traffic to your Mac?
    – nohillside
    Jun 15, 2013 at 8:59
  • Yes I did. Port 22, forwards straight to my Mac.
    – Tamara
    Jun 15, 2013 at 12:40
  • Some ISPs block incoming traffic on certain ports. Try using a different incoming port on your router. I.e. forward port 2200 on the router to port 22 on your Mac (and of course, change your settings to connect to port 2200 on your external IP).
    – robmathers
    Jun 15, 2013 at 20:19

2 Answers 2


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

Here's what I have setup in the past, which does allow me to access my Mac via ssh:

On my AT&T gateway, I setup the firewall settings to push all internet traffic directly to my Airport Extreme. While the Airport Extreme is by no means an enterprise class firewall, it actually works really well for home/small office security needs. I then use the Airport Extreme to send all traffic on port 22 to the internal IP address of my Mac mini. I have my DHCP settings on the Airport Extreme setup with a static map, which always gives the same IP address to my Mac mini. I then use Terminal, and type in the following:

ssh UserName@MyPublicIPAddress

After this, I'm asked for the password of my user name. Once I put in the password, Terminal then gives me a prompt for the user account that I logged in as through ssh.

Keep in mind that by sending all ssh traffic directly to your home system you are opening up a big security hole. Even with a strong password, you're still at serious risk. I've only done this on a few occasions, and for very specific reasons. When I used to run OS X Server at home, I had ssh forwarded directly to my server. The server's logs showed that I was constantly under attack. People trolling the internet had found my server, and they were constantly trying to break in. After I noticed that, I setup VPN so as to have one more barrier between my server and the outside.

  • Any suggestions to how to add a guest public ssh key for remote access?
    – Charles
    Jan 10, 2014 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .