I want to SSH to a Windows 2012 server. But I get "connection refused."

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of Kiran Kiran 11 months, 1 week ago.

  • Author
  • #50086
    Profile photo of Kiran

    I installed the 64 bit version of OpenSSH on a Windows Server 2012 machine. In PowerShell I started the SSH service. I could not SSH to the Windows server from the server itself. This is how I test SSH on Linux.

    I tried to SSH from a Linux server to the Windows server. I got the error "connection refused." I know that port 22 is not blocked from the Linux server to the Windows server. What do I need to do to get OpenSSH to work?

    I followed all of the github directions except the optional steps. What am I doing wrong?

  • #50089
    Profile photo of John_JHA

    Any entry in Windows server event/firewall logs about the dropped connection?

    Curious. Can you telnet (port 23) to it for test purposes?

  • #50250
    Profile photo of Kiran

    I could not use Putty to get into the Windows server. I get "connection refused." Port 23 is not blocked between the Linux server and Windows server. I don't have any way of using telnet that I can think of. I saw nothing in the logs. No connection ever initiates.

  • #50260
    Profile photo of Daniel Krebs
    Daniel Krebs

    First get an SSH connection going from the Windows server itself. Do you see the OpenSSH server listening on port 22?

    PowerShell command:

    Get-NetTCPConnection | Where-Object { $_.LocalPort -eq 22 }

    PowerShell output:

    LocalAddress                        LocalPort RemoteAddress                       RemotePort State       AppliedSetting OwningProcess 
    ------------                        --------- -------------                       ---------- -----       -------------- ------------- 
    ::                                  22        ::                                  0          Listen                     3564                                  22                             0          Listen                     3564

    Command Prompt command:

    netstat -an -p tcp | findstr

    Command Prompt output:

      TCP                 LISTENING
  • #50709
    Profile photo of Kiran

    I eventually got it to work. I do not know the root cause.

You must be logged in to reply to this topic.