This hang occurs when an SSH remoting endpoint is misconfigured. The SSH client used to establish the connection ends silently, without having established the subsystem connection. The PowerShell remoting layer gets no error and remains indefinitely in a pre-connection state. I have repro'd this only on Windows so far, but suspect the same problem exists on non-Windows platforms.
I found this while investigating PowerShell SSH test hang issue. I don't know if this is the same issue as with the automated tests, but should be fixed.
Steps to reproduce
# Misconfigure endpoint by providing invalid path in subsystem
# sshd_config file
Subsystem powershell E:\InvalidPath\publish\pwsh.exe -SSHS -NOLOGO -NOPROFILE
$session = New-PSSession -HostName localhost
Expected behavior
Error returned because the endpoint is invalid.
Actual behavior
Environment data
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
This hang occurs when an SSH remoting endpoint is misconfigured. The SSH client used to establish the connection ends silently, without having established the subsystem connection. The PowerShell remoting layer gets no error and remains indefinitely in a pre-connection state. I have repro'd this only on Windows so far, but suspect the same problem exists on non-Windows platforms.
I found this while investigating PowerShell SSH test hang issue. I don't know if this is the same issue as with the automated tests, but should be fixed.
Steps to reproduce
Expected behavior
Actual behavior
Environment data