Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently bought a Macbook Air with Lion. I would like to ssh into my Mac at work. How do I set this up?

I have a private and public key, so I will likely use that option to allow access into my mac.

share|improve this question
What did you try so far? – Daniel Beck Feb 27 '12 at 17:41
This should give you the guidance you need: – xXPhenom22Xx Feb 27 '12 at 17:46
Thanks, I have tried altering Apple -> System Preferences -> Sharing -> Remote Login and then sshing into my mac air with ssh as the instructions told me. However, this method fails since the terminal notes that the host is not recognized. – David Faux Feb 27 '12 at 18:19
By the way, this IP address is fake, so I didn't reveal anything :) – David Faux Feb 27 '12 at 18:24
You seem to be behind a firewall that's blocking SSH access from outside. Could that be? From where are you trying to SSH in, actually? You can also try to find out your real computer's IP (not the dhcp-.. hostname) and ssh to that. – slhck Feb 27 '12 at 18:47
up vote 10 down vote accepted

Apple -> System Preferences -> Sharing -> Remote Login.

share|improve this answer
It shows the IP of the local network, how can I ssh from the outside? – ilyo Jan 8 '15 at 13:54
You can't, @ilyo. Private addresses are only locally accessible. – Scott Wilson Jan 9 '15 at 14:59
I know I can't use that address outside, I'm asking how can I ssh to the mac from the outside. – ilyo Jan 9 '15 at 15:13

If you want to be able to SSH from work to home, you'll need to do the following:

  • Get the external IP address of your home network. You can obtain this by going to this website. If you ISP changes your IP frequently, you'll have to use something like Dyn DNS.

  • Open port 22 on your firewall/router and point it to the local IP address of the Mac you want to connect to. Instructions for this step vary on your firewall/router model. You may want to set up a DHCP reservation for this Mac so the internal IP address doesn't change.

  • On the Mac your want to connect to, open System Preferences → Sharing and enable Remote Login.

  • You should now be able to run the command ssh user@ip.of.your.mac, replacing "user" with the home computer's username and the "ip.of.your.mac" with the home IP address.

share|improve this answer
  1. Simply activate the option in Preferences : "Remote login".

  2. Access your mac :

    ssh username@ip.of.your.mac

share|improve this answer

You must log in to answer this question.

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