PowerShell / PowerShell/PowerShell

Powershell remote via SSH does not support non-admin user

Open
#20,583 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs-Triage WG-NeedsReview WG-Remoting
Dominant language
C#
Stars
55.5k
Forks
8.5k
Avg merge
1d 2h
Merged PRs (30d)
88

Description

Prerequisites
Steps to reproduce
  1. Create a non admin user
  2. Enable the non-admin user for powershell remote (via winrm): https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_remote_troubleshooting?view=powershell-7.3#how-to-enable-remoting-for-non-administrative-users
  3. test ps session
    Enter-PSSession -HostName -KeyFilePath $HOME/.ssh/id_rsa non-admin@targethost -SSHTransport
    or
    $remote_session = New-PSSession -HostName -KeyFilePath $HOME/.ssh/id_rsa non-admin@targethost -SSHTransport
Expected behavior
PS session can be created.
Actual behavior
The SSH client session has ended with error
     | message: The SSH transport process has abruptly terminated causing this
     | remote session to break.
Error details
The SSH client session has ended with error
     | message: The SSH transport process has abruptly terminated causing this
     | remote session to break.

More Info:
without Powershell Remote Session, access the target host with non admin user via ssh command works, for example:
ssh -i $HOME/.ssh/id_rsa "$REMOTE_USER"@"$REMOTE_HOST" "dir"


based on the following issues:
https://github.com/PowerShell/Win32-OpenSSH/issues/1652
https://github.com/microsoft/vscode-remote-release/issues/8123
https://github.com/PowerShell/PowerShell/issues/18140

I think the Powershell Remote via SSH does not support for a non-admin user. And Powershell Remote via SSH does not support JEA either.
Environment data
for ssh client (a docker container):
PSVersion                      7.3.1
PSEdition                      Core
GitCommitId                    7.3.1
OS                             Linux 4.18.0-372.64.1.el8_6.x86_64 #1 SMP Thu J…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


For ssh server (a Windows VM):
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
PSEdition                      Core
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
OS                             Microsoft Windows 10.0.17763
PSVersion                      7.3.4
GitCommitId                    7.3.4
PSRemotingProtocolVersion      2.3
Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with Enter-PSSession and New-PSSession using SSHTransport, following the non-administrative Windows user setup described in the steps. Compare the failing PowerShell remoting connection with the working direct ssh command and review the linked OpenSSH and PowerShell issues. Done means a non-admin user can create a PowerShell SSH session without the transport process terminating.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.