How do I set up SSH into my Mac with Lion?

9

1

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.

David Faux

Posted 2012-02-27T17:39:02.413

Reputation: 4 477

2What did you try so far? – Daniel Beck – 2012-02-27T17:41:36.043

This should give you the guidance you need: http://www.stocksy.co.uk/articles/Mac/ssh_on_mac_os_x/

– xXPhenom22Xx – 2012-02-27T17:46:10.773

Thanks, I have tried altering Apple -> System Preferences -> Sharing -> Remote Login and then sshing into my mac air with ssh davidfaux@dhcp-12-259-119-81.yale.edu as the instructions told me. However, this method fails since the terminal notes that the host dhcp-12-259-119-81.yale.edu is not recognized. – David Faux – 2012-02-27T18:19:39.750

By the way, this IP address is fake, so I didn't reveal anything :) – David Faux – 2012-02-27T18:24:24.657

1You 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 – 2012-02-27T18:47:57.527

Answers

10

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

Scott C Wilson

Posted 2012-02-27T17:39:02.413

Reputation: 2 210

It shows the IP of the local network, how can I ssh from the outside? – ilyo – 2015-01-08T13:54:53.397

You can't, @ilyo. Private addresses are only locally accessible. – Scott C Wilson – 2015-01-09T14:59:04.167

1I know I can't use that address outside, I'm asking how can I ssh to the mac from the outside. – ilyo – 2015-01-09T15:13:30.943

4

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.

Matt Love

Posted 2012-02-27T17:39:02.413

Reputation: 199

2

  1. Simply activate the option in Preferences : "Remote login".

  2. Access your mac :

    ssh username@ip.of.your.mac

Zenklys

Posted 2012-02-27T17:39:02.413

Reputation: 201