none
Connection Refused on Port 22 RRS feed

  • Question

  • I have been facing "Connection refused" error on my windows 10. Was working fine about 6 months back. Cant even do "ssh localhost" from command prompt. I tried opening the port 22 setting up inbound and outbound. Also reinstalled windows and installed the OpenSSH Client and OpenSSH Server. Not sure how to debug further. Any idea on what else to do next.

    Thanks,

    Kiran

    Sunday, May 19, 2019 7:10 PM

All replies

  • Open an admin command prompt and verify that the service is running and listening on 22. The netstat command will show you the pid of the process. In my case it was 2700. Use the number that you get on the tasklist command. 

    C:\Windows\system32>net start | findstr -i ssh
       OpenSSH SSH Server
    C:\Windows\system32>netstat -aon | findstr -i listen | findstr 22
      TCP    0.0.0.0:22             0.0.0.0:0              LISTENING       2700
      TCP    [::]:22                [::]:0                 LISTENING       2700
    C:\Windows\system32>tasklist /fi "pid eq 2700"
    Image Name                     PID Session Name        Session#    Mem Usage
    ========================= ======== ================ =========== ============
    sshd.exe                      2700 Services                   0      5,672 K

    If the service isn't running, run net start "OpenSSH SSH Server"

    If the service doesn't start check your event logs for errors. 

    Sunday, May 19, 2019 9:16 PM
  • Hi,

    We could refer to the link below to check if any help:

    connect to host localhost port 22: Connection refused

    https://stackoverflow.com/questions/17335728/connect-to-host-localhost-port-22-connection-refused

    Please Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, May 20, 2019 4:52 PM
    Moderator
  • Hi, 
    Was your issue solved?
    If yes, would you like to share your solution in order that other community members could find the helpful reply quickly.
    If no, please reply and tell us the current situation in order to provide further help. 
    Best Regards,

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, May 23, 2019 8:13 AM
    Moderator