Powershell remote fails with "The SSH client session has ended with error message: subsystem request failed on channel 0."

Viewed 3720

I am running Windows 10 Pro on one of my workstations with ssh enabled. I am able to ssh from my Mac to Windows successfully but when I try the command

New-PSSession -HostName xxxx -UserName yyyy

I receive the following message after entering my password: The background process reported an error with the following message:

The SSH client session has ended with error message: subsystem request failed on channel 0.

3 Answers

Sorry, I also ran into the same issue and couldn't get it done.

the best way I think is to run it using shh directly

Eg:

ssh user@ip-or-hostname "quser"

enter image description here

also have this issue.... using ssh directly is working but I was trying to do something like that:

$s = New-PSSession -ComputerName myComputer -UserName userName -Port sshPort

Invoke-Command -Session $s -ScriptBlock {
   cd /pathToDockerCompose

   docker-compose down
   docker-compose up -d
}

so if someone has an alternative to do this, I'm all ears :-).

edit: btw, I want it to be called from a Windows machine and executed on linux.

Had a similar situation just occur on one of my machines, SSH worked but trying to SSH through powershell with Enter-PSSession gave the same "subsystem request failed on channel 0" error. Turns out I didn't have the powershell subsystem registered in the sshd_config file for OpenSSH.

See https://lazyadmin.nl/powershell/powershell-ssh/ for additional info and the same change I made to get it working

Related