0

I just started to experiment with ssh and port forwarding. I use ubuntu to ssh into my iMac. The iMac says to use ssh user1@host and that works fine when I am using the same network. However, when I connect to my Ubuntu to another network, say at work, and try to ssh into my iMac with ssh -v -v -v user1@host -p 22 I get the following output:

debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connect to address user1@host port 22: Connection timed out

I setup my router to forward port 22 to my iMac's ip address--I'm not sure if my ISP is blocking this port, I still need to check this. My router is Netgear Nighthawk R7800 AC2600. Is there anything I need to setup in Ubuntu, in the ssh_config file, to make this connection work?

0

I would recommend using canyouseeme.org to check if your ISP is blocking SSH.

I would also check that your iMac is getting a static IP address - otherwise, it'll change, meaning the port forward you set up will become obsolete.

I wanted to add that opening up SSH as you describe is very dangerous. You should use something to block abuse. For example, right now, I have a web server with SSH open, running fail2ban.

fail2ban works by routing IP addresses to 0.0.0.0 in iptables. I've configured it so that if you get the password wrong twice, it blocks your IP address for a long time. The incorrect attempts must be within 24 hours of each other.

I just ran sudo iptables -L -n | grep -c 0.0.0.0 which counts how many IP addresses are blocked right now. It returned 356, and this is on a site which barely has any visitors.

If you're opening up ports through your firewall to your home PC, bots are going to find it and break in. I don't know how you go about installing this sort of a thing in macOS, but I'd highly recommend doing so.

  • 1
    Thanks for the advice, I'll look into fail2ban and use canyouseeme.org. I'll report back tonight. – d84_n1nj4 May 16 '18 at 16:01
  • I ended up fixing the issue. I was using the incorrect ip address when I was ssh'ing into my router. I was originally using the ip address my iMac told me to use under Remote Login. This worked when I was on the same network but not when I was on another network. I had to use the router ip address found on the router setup page. I'll leave this here since it may help someone. Now I need to find out how to configure fail2ban on Mac OS X 10.13. There seems to be very little new documentation. – d84_n1nj4 May 17 '18 at 12:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.