Enter-PSSession The SSH client session has ended with error - from fedora linux

Salam ELIAS 137 Reputation points
2025-03-04T17:35:46.1233333+00:00

I have a fresh win 2019, added open-ssh and configured winRM.

From the fedora box, I can ssh into the win

User's image

Also, when I telnet to port 5985, it works fine

User's image

However, when I try

Enter-PSSession -HostName dbservansible -UserName ansible

I get

Enter-PSSession: The SSH client session has ended with error message: The SSH transport process has abruptly terminated causing this remote session to break.

my user is in the remote manag group as well as in admin group.

In sshd_config I did

PasswordAuthentication yes

Subsystem powershell c:/progra~1/powershell/7/pwsh.exe -sshs -nologo

Whait is missing?

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,882 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Salam ELIAS 137 Reputation points
    2025-03-04T17:44:22.5933333+00:00

    One thing I would like to add, I have just discovered that issuing

    winrm get winrm/config/Listener

    I get

    WSManFault

    Message
    
        ProviderFault
    
            WSManFault
    
                Message = This resource requires the following selectors: Address Transport
    

    Error number: -2144108454 0x8033805A

    The WS-Management service cannot process the request because the request did not contain all required selectors.

    but issuing

    winrm e winrm/config/listener

    It seems verything OK

    Listener

    Address = *
    
    Transport = HTTP
    
    Port = 5985
    
    Hostname
    
    Enabled = true
    
    URLPrefix = wsman
    
    CertificateThumbprint
    
    ListeningOn = 127.0.0.1, 192.168.1.43, ::1, fe80::9aff:885e:b97e:80a1%4
    

    running

    winrm get winrm/config -r:dbservansible

    again it seems OK

    Config

    MaxEnvelopeSizekb = 500
    
    MaxTimeoutms = 60000
    
    MaxBatchItems = 32000
    
    MaxProviderRequests = 4294967295
    
    Client
    
        NetworkDelayms = 5000
    
        URLPrefix = wsman
    
        AllowUnencrypted = false
    
        Auth
    
            Basic = true
    
            Digest = true
    
            Kerberos = true
    
            Negotiate = true
    
            Certificate = true
    
            CredSSP = false
    
        DefaultPorts
    
            HTTP = 5985
    
            HTTPS = 5986
    
        TrustedHosts
    
    Service
    
        RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
    
        MaxConcurrentOperations = 4294967295
    
        MaxConcurrentOperationsPerUser = 1500
    
        EnumerationTimeoutms = 240000
    
        MaxConnections = 300
    
        MaxPacketRetrievalTimeSeconds = 120
    
        AllowUnencrypted = false
    
        Auth
    
            Basic = false
    
            Kerberos = true
    
            Negotiate = true
    
            Certificate = false
    
            CredSSP = false
    
            CbtHardeningLevel = Relaxed
    
        DefaultPorts
    
            HTTP = 5985
    
            HTTPS = 5986
    
        IPv4Filter = *
    
        IPv6Filter = *
    
        EnableCompatibilityHttpListener = false
    
        EnableCompatibilityHttpsListener = false
    
        CertificateThumbprint
    
        AllowRemoteAccess = true
    
    Winrs
    
        AllowRemoteShellAccess = true
    
        IdleTimeout = 7200000
    
        MaxConcurrentUsers = 2147483647
    
        MaxShellRunTime = 2147483647
    
        MaxProcessesPerShell = 2147483647
    
        MaxMemoryPerShellMB = 2147483647
    
        MaxShellsPerUser = 2147483647
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.