0

I'm trying to set up my iMac so I can ssh into it remotely (from outside my home network.) I also have a Linux server which, when using the same port forwarding in my router, I can do with zero problems.

From behind my router, I can ssh from my Linux box to my iMac with no trouble, both using internal IP (192.168.1.5) and the hostname (iKho), so the Remote Login (ssh) service is obviously working on my iMac.

If I go into my router and forward port 22 to my Linux machine, I can access it immediately after making the change - I ssh using my freedns hostname from my iPhone (strictly using my cell connection, not on wifi) and it just works.

As soon as I go back into the router, edit the SSH port forward to talk to my iMac (so I'm literally just changing the internal IP address), it refuses to work. Using the same iPhone connection, it errors out with "Unable to connect to server, please try again later."

Technically, I know I could leave it set to my Linux machine, and then ssh from there into my Mac. But for a demonstration I want to give in one of my classes, I need to be able to ssh directly into the Mac first.

I'm out of ideas - I don't see how it works locally both ways, but then only works to my Linux machine remotely. Is there some kind of limitation of MacOS's ssh server?

Thanks for any help,

  -Bryan
3
  • Your description doesn't yet rule out the possibility that the problem might be resolved by sshing to your mac from a different machine. Can you either (a) connect the machine (or a machine with equivalent O/S and ssh) from which you unsuccessfully remotely ssh to your mac box to your home network? or (b) try sshing from some other machine which is running identical linux+ssh as you have successfully used at home? Nov 4, 2017 at 23:18
  • Although a simpler first step is ssh -v . The debug output from ssh is quite comprehensive : it will tell you what it has tried and what failed. Nov 4, 2017 at 23:21
  • 3rdly: Look at the mac's log of incoming ssh attempts: superuser.com/questions/838352/log-file-for-ssh-attempts Nov 4, 2017 at 23:23

1 Answer 1

0

Did you try completely disabling MacOS firewall?

This may be a MacOS firewall issue, with it setting 192.168.* as an unrestricted local area network and not allowing "external" access. Linux typically allows ssh access from anywhere, once you enable it.

1
  • Wow, yep - this was it. Although not the MacOS firewall, but the one I didn't think of - My McAfee Livesafe had the firewall turned on as well, with a default rule of "Deny any remote connections"...which I also was unable to change, so disabled that firewall completely. Here's some output: Nov 4 19:36:28 iKho sshd[790]: Accepted keyboard-interactive/pam for bryan from 192.80.186.226 port 64913 ssh2 Nov 4 19:36:30 iKho sshd: bryan [priv][790]: USER_PROCESS: 795 ttys001 Logged in through an ssh app on my iPhone, not on my local wifi. Thanks for solving this! :) Nov 5, 2017 at 0:42

You must log in to answer this question.

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