How to connect 2 Macs via SSH on a home network?

13

3

First off, I'm not 100% sure this question is on-topic on StackOverflow, but here you go :

I've set up a home network :

  • 1 wireless router connected to the internet
  • my 2 Macs connected to the wireless router

Is there any way I could use SSH to connect from my Mac No 1 to my Mac No 2?

And How?

Dr.Kameleon

Posted 2012-04-18T03:32:32.253

Reputation: 331

1System Preferences > Sharing, check Remote Login – cfeduke – 2012-04-18T03:36:13.710

1It's off-topic (although arguably "developer tools"), but at least it is a well-enough written question. – pst – 2012-04-18T03:41:52.507

Answers

9

Yes.

First, go to System Preferences -> Sharing. Turn on Remote Login (see image).

Then, from a terminal, execute:

$ ssh <machine name>.local

Remote Login

Greg Kopff

Posted 2012-04-18T03:32:32.253

Reputation: 237

Well, what do you mean by Machine name? The computer name of the receiver? I tried that and i'm getting a ssh: Could not resolve hostname drkMBPro: nodename nor servname provided, or not known – Dr.Kameleon – 2012-04-18T03:42:24.213

just fixed it by using drkMBPro.local as my Machine name... That was quite easy; I'm still quite new to Macs... so... Thanks a lot, buddy! :-) – Dr.Kameleon – 2012-04-18T03:44:30.407

1Of the receiver yes. When you turned on sharing on that machine, what did it report (see in the graphic it says: "To log in to this computer remotely, type 'ssh greg@zaphod'"). – None – 2012-04-18T03:44:40.850

Yep, that last one works too. ;-) – Dr.Kameleon – 2012-04-18T03:45:09.627