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  Kiran 1 year, 1 month ago.

  • Author
    Posts
  • #50086

    Kiran
    Participant

    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

    John_JHA
    Participant

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

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

  • #50250

    Kiran
    Participant

    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

    Daniel Krebs
    Moderator

    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
    
  • #50709

    Kiran
    Participant

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

You must be logged in to reply to this topic.