5

I want to open a connection to my mac (10.8) via SSH. An SSH-server is installed by default on OSX. Remote login is enabled, so the service is running and I can connect to to localhost via ssh.

enter image description here

The firewall is enabled, and the port for SSH is open. If I connect from another computer on the same local network, I get a connection timeout.

enter image description here

What am I missing here?


NMAP Test

>> nmap -vv -sP 192.168.1.22

Starting Nmap 5.21 ( http://nmap.org ) at 2012-12-30 23:05 CET
Initiating Ping Scan at 23:05
Scanning 192.168.1.22 [2 ports]
Completed Ping Scan at 23:05, 0.00s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 23:05
Completed Parallel DNS resolution of 1 host. at 23:05, 0.00s elapsed
Nmap scan report for macbook (192.168.1.22)
Host is up (0.0034s latency).
Nmap done: 1 IP address (1 host up) scanned in 0.01 seconds
12
  • 1
    How do you connect to the internet? Specifically, are you behind a router?
    – Dennis
    Dec 30, 2012 at 12:55
  • Both computers are connected to the same router, the mac via wifi. It has worked before, and I can connect from the mac to the other computer using SSH.
    – SPRBRN
    Dec 30, 2012 at 16:23
  • Try making the two computers listen to different ports. You can add a listening port by adding the line Listen PORTNUMBER to /etc/ssh/sshd_config.
    – Dennis
    Dec 30, 2012 at 16:44
  • To help diagnose try to nmap to your mac from another computer on the same local network. You should see port 22 open (or whatever you have set it to if you have changed it per Dennis' suggestion above)
    – sdjuan
    Dec 30, 2012 at 17:25
  • 1
    how do you connect over the computer name or the ip of the Mac?
    – konqui
    Jan 22, 2014 at 18:08

3 Answers 3

2

Verify the listening socket:

netstat -an|grep LISTEN|grep 22
tcp6       0      0  *.22                   *.*                    LISTEN     
tcp4       0      0  *.22                   *.*                    LISTEN     

Then try a plain connect from another machine on the same subnet i.e. telnet 192.168.1.22 22

Trying  192.168.1.22...
Connected to macbook
Escape character is '^]'.
SSH-2.0-OpenSSH_5.9

Do you see the line with 'Escape character'? then the port is visible.

Do you see the SSH header? then sshd is available

Try

ssh -v 192.168.1.22 -l $USERNAME

You configured for specific users, that would not cause a time-out for other users.

2

I had the same problem. I solved it by enabling the option "sshd-keygen-wrapper" in my firewall. I hope this helps.

2
  • 1
    How do you do this?
    – Pablo
    May 12, 2017 at 20:25
  • Thanx, It worked, was struggling with this from quite sometime ... This is the perfect solution for the above Problem.
    – Napster_X
    May 29, 2017 at 9:22
1

I've had the same issue for a number of years and I decided to figure it out today. Turns out that in the same firewall settings, you also need to allow incoming connections for sshd-keygen-wrapper.

sshd-keygen-wrapper

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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