Setting up OpenSSH for Windows using public key authentication

后端 未结 8 950
忘掉有多难
忘掉有多难 2020-12-07 09:06

I am having issues setting up OpenSSH for Windows, using public key authentication.

I have this working on my local desktop and can ssh with a key from Unix machines

8条回答
  •  温柔的废话
    2020-12-07 09:26

    Use this sequence of commands in PowerShell to correct permission of administrators_authorized_keys

    $acl = Get-Acl C:\ProgramData\ssh\administrators_authorized_keys
    $acl.SetAccessRuleProtection($true, $false)
    $administratorsRule = New-Object system.security.accesscontrol.filesystemaccessrule("Administrators","FullControl","Allow")
    $systemRule = New-Object system.security.accesscontrol.filesystemaccessrule("SYSTEM","FullControl","Allow")
    $acl.SetAccessRule($administratorsRule)
    $acl.SetAccessRule($systemRule)
    $acl | Set-Acl
    

    Only SYSTEM and Administrators group must be have permission in file without inherited.

提交回复
热议问题