Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Transport error when allowing a new host during SSH PowerShell remoting #2432
This seems to be a bug only in Win32-OpenSSH ssh.exe client, so I'll create an issue there as well. When the client prompts for host authenticity ssh.exe writes an error in StdErr with a blank message string. Currently PowerShell SSH remoting treats any StdErr from ssh.exe client as a terminating error and terminates the transport connection. This does not repro on a Linux client but only on Windows using Win32-OpenSSH.
The fix in PowerShell SSH remoting is to ignore all blank error messages from StdErr.
Steps to reproduce
PS C:\> del C:\users\<user>\.ssh\known_hosts PS C:\> New-PSSession -HostName $env:computername -UserName userName The authenticity of host 'computer' can't be established. ECDSA key fingerprint is SHA256:AeRUkqd3vJjZDNI07Do4BBpmutic4UR35bKw3FBV6a4. Are you sure you want to continue connecting (yes/no)? Warning: Permanently added 'computer' to the list of known hosts. New-PSSession : [computer] The background process reported an error with the following message: The SSH client session has ended with no error message.. At line:1 char:1 + New-PSSession -HostName $env:computername -user userName + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin gTransportException + FullyQualifiedErrorId : 2100,PSSessionOpenFailed
No error after adding target computer to trusted hosts list.
Error and connection termination.
I have a simple fix for this but have not generated a PR yet. But this is not a blocking bug. I neglected to mention that the workaround is to simply run the New-PSSession Cmdlet a second time and the connection will succeed (since the host has been added to the trusted list).
If you are interested the fix is at https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs