Created
November 26, 2021 16:31
-
-
Save themegabyte/fde4c3ea77e323c2eb1ef79f407228d9 to your computer and use it in GitHub Desktop.
Fix Permissions for private key in OpenSSH ssh-add for Windows 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Courtesy: https://superuser.com/a/1329702 | |
# Set Key File Variable: | |
New-Variable -Name Key -Value "$env:UserProfile\.ssh\id_rsa" | |
# Remove Inheritance: | |
Icacls $Key /c /t /Inheritance:d | |
# Set Ownership to Owner: | |
Icacls $Key /c /t /Grant $env:UserName:F | |
# Remove All Users, except for Owner: | |
Icacls $Key /c /t /Remove Administrator BUILTIN\Administrators BUILTIN Everyone System Users | |
# Verify: | |
Icacls $Key | |
# Remove Variable: | |
Remove-Variable -Name Key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment