I seem to be having a problem with trying to ssh into my Mac from a Linux desktop. I have two users on my Mac and can ssh between them, but other computers seem to be the problem.

I enabled remote login in System Preference > Sharing. It tells me to try "ssh [email protected]", but when I try that it does not work, likewise when I try using ssh -p22.

Later I generated an RSA file using ssh-keygen in the Linux desktop and added it into the Mac's authorized_keys file. Please note that I am able to ssh into the Linux desktop without any problem.And my firewall is off on the mac.

I do not even get prompted to enter the password, it just does nothing for some time and then later displays:-

ssh -p22 [email protected]

ssh: connect to host 192.168.x.x port 22: Connection timed out

I know I am connected to the internet. This is the verbose output:

OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 19: Applying options for *

debug1: Connecting to 192.168.x.x [192.168.x.x] port 22.

debug1: connect to address 192.168.x.x port 22: Connection timed out

ssh: connect to host 192.168.x.x port 22: Connection timed out

Does anyone have an idea what the problem may be? What other steps can I try to resolve this?

1 Answer 1


If you're getting timeouts, that has nothing to do with your authentication mechanism - whether password, or key based.

The timeout means either you can't connect to the Mac at all, or it's not accepting traffic on port 22 (the SSH port)

Some things to check -

  • Have you checked your firewall is off on the mac? System Preferences -> Security -> Firewall
  • Can you ping the Mac from the Linux desktop? A simple ping to the Mac will verify that they're on the same network and can communicate.

Fix your network issue before you try to fix your authentication.

  • yes, the firewall is off......but I did try to ping it ...... I tried the IP address show in in the remote login screen of system preferences and also the IP address shown in by google ..... nothing is happening......just static Jul 2, 2017 at 3:35
  • Hey..... I came home and I used putty on my windows computer that is on the same network and tried to connect to my mac and it worked like butter.....So I assume that the computers in my local wifi network can connect between them...but how can I connect my linux desktop that is in my office to my mac.....both are connected to the internet and switched on. Jul 2, 2017 at 8:14
  • So these computers are on different networks?
    – Alex
    Jul 6, 2017 at 2:04
  • yes...these computers are on different networks.....if I connect to a computer on the same network it works fine,,,,what should I do to connect to the mac from a different network? Jul 28, 2017 at 20:08
  • 1
    You need to ensure that your access to point to your network that is receiving the connection is configured to receive and forward to the correct host. This is normally configured in the NAT or port-forwarding settings of your router. You'll need to forward port 22 to your server.
    – Alex
    Jul 29, 2017 at 2:19

You must log in to answer this question.

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