Skip to content

Instantly share code, notes, and snippets.

@micahyoung
Last active September 1, 2020 21:57
Show Gist options
  • Save micahyoung/b0c18ebde42263ee8ec9a15dada4327e to your computer and use it in GitHub Desktop.
Save micahyoung/b0c18ebde42263ee8ec9a15dada4327e to your computer and use it in GitHub Desktop.
Fix Windows OpenSSH administrator authorized key file key permissions
$sshPubKey="ssh-rsa AAAA..."
echo $sshPubKey | out-file -Encoding ascii -Append C:\ProgramData\ssh\administrators_authorized_keys
$acl = Get-Acl C:\ProgramData\ssh\administrators_authorized_keys
$acl.SetSecurityDescriptorSddlForm("O:BAG:BAD:PAI(A;;FA;;;SY)(A;;FA;;;BA)")
$acl | Set-Acl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment