PowerShell / PowerShell/Win32-OpenSSH

Permissions repair PowerShell scripts do not work in an ssh session.

Open
#1,877 4 comments 0 reactions 1 assignee View on GitHub

@tgauth is already working on this.

Since Jan 10, 2022.

Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

"OpenSSH for Windows" version
8.0.0.0

Server OperatingSystem
Windows 10 Pro

Client OperatingSystem
Windows 10 Pro

What is failing

powershell -noprofile -file .\FixUserFilePermissions.ps1

when connected to the computer over ssh, with the default shell set to:

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.22523
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Expected output

  [*] ~\.ssh\config
      looks good

  [*] C:\Users\rkitover\.ssh\id_rsa
      looks good

  [*] C:\Users\rkitover\.ssh\id_rsa.pub
      looks good

   Done.

Actual output

Repair-FilePermission : Cannot validate argument on parameter
'Owners'. The argument has a null value, or an element of the
argument collection contains a null value. Provide a collection
that does not contain any null values, and then try the command
again.
At C:\Users\rkitover\tmp\OpenSSHUtils.psm1:260 char:39
+ ...  Repair-FilePermission -Owners
$UserSid,$adminsSid,$systemSid -AnyAcc ...
+                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Repair-FilePermiss
   ion], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Rep
   air-FilePermission

Repair-FilePermission : Cannot validate argument on parameter
'Owners'. The argument has a null value, or an element of the
argument collection contains a null value. Provide a collection
that does not contain any null values, and then try the command
again.
At C:\Users\rkitover\tmp\OpenSSHUtils.psm1:241 char:39
+ ... Repair-FilePermission -Owners $UserSid,
$adminsSid,$systemSid -AnyAcc ...
+                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Repair-FilePermiss
   ion], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Rep
   air-FilePermission

Repair-FilePermission : Cannot validate argument on parameter
'Owners'. The argument has a null value, or an element of the
argument collection contains a null value. Provide a collection
that does not contain any null values, and then try the command
again.
At C:\Users\rkitover\tmp\OpenSSHUtils.psm1:244 char:39
+ ... Repair-FilePermission -Owners $UserSid,
$adminsSid,$systemSid -AnyAcc ...
+                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Repair-FilePermiss
   ion], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Rep
   air-FilePermission

   Done.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.