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

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?

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

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

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.

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          
0.0.0.0                             22        0.0.0.0                             0          Listen                     3564

Command Prompt command:

netstat -an -p tcp | findstr 0.0.0.0:22

Command Prompt output:

  TCP    0.0.0.0:22             0.0.0.0:0              LISTENING

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