Powershell Subsystem Fails when using a banner in OpenSSH
See original GitHub issueUsing a Banner option within sshd_config causes the connection to fail
Banner /etc/ssh/banner
If we comment out the Banner line, and restart sshd, client connections work just fine.
Steps to reproduce
PS /Users/drewstinnett> Enter-PSSession -Host host.example.com -SSHTransport -UserName drews
Enter-PSSession : The background process reported an error with the following message: The SSH client session has ended with error message:
####
# Example Banner
####
At line:1 char:1
+ Enter-PSSession -Host host.example.com -SSHTransport -UserNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException,Microsoft.PowerShell.Commands.EnterPSSessionCommand
PS /Users/drewstinnett>
Expected behavior
PS /Users/drewstinnett> Enter-PSSession -Host host.example.com -SSHTransport -UserName drews
####
# Example Banner
####
[host.example.com]: PS /home/drews>
Actual behavior
PS /Users/drewstinnett> Enter-PSSession -Host host.example.com -SSHTransport -UserName drews
Enter-PSSession : The background process reported an error with the following message: The SSH client session has ended with error message:
####
# Example Banner
####
At line:1 char:1
+ Enter-PSSession -Host host.example.com -SSHTransport -UserNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException,Microsoft.PowerShell.Commands.EnterPSSessionCommand
PS /Users/drewstinnett>
Environment data
PowerShell v6.0.0-beta.8
Copyright (C) Microsoft Corporation. All rights reserved.
PS /root> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-beta.8
PSEdition Core
GitCommitId v6.0.0-beta.8
OS Linux 3.10.0-693.2.2.el7.x86_64 #1 SMP Sat Sep 9 03:55:24 EDT 2017
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS /root>
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Passwordless SSH login into WSL2 failing
First, the most likely reason for it failing is as Ramhound ... Confirm that you can log to Windows OpenSSH from WSL using...
Read more >Powershell remote fails with "The SSH client session has ...
The SSH client session has ended with error message: subsystem request failed on channel 0.
Read more >What causes SSH error: kex_exchange_identification ...
I get the error: kex_exchange_identification : Connection closed by remote ... You can specify a custom port using ssh -p port user@host.
Read more >PowerShell remoting to Linux Servers
Scroll down and change “Banner /etc/motd” to “#Banner /etc/motd“, use CTRL-X, Y, and Enter to Save the file and Quit. Run “sudo service...
Read more >about Pwsh - PowerShell
Explains how to use the `pwsh` command-line interface. Displays the command-line parameters and describes the syntax.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is this issue going to be investigated?If a banner is used (for example in corporate environments with a legal statement before connecting to a linux machine) , you need a windows machine for powershell remoting to other linux machines.
Works for me too. issue has been resolved.