file permissions windows
This commit is contained in:
parent
0f62910f62
commit
0fc8b61fdc
22
set-ssh-key-permissions.ps1
Normal file
22
set-ssh-key-permissions.ps1
Normal file
@ -0,0 +1,22 @@
|
||||
# Set Key File Variable:
|
||||
New-Variable -Name Key -Value "$env:UserProfile\.ssh\odroid_rsa"
|
||||
|
||||
# Remove Inheritance:
|
||||
Icacls $Key /c /t /Inheritance:d
|
||||
|
||||
# Set Ownership to Owner:
|
||||
# Key's within $env:UserProfile:
|
||||
Icacls $Key /c /t /Grant ${env:UserName}:F
|
||||
|
||||
# Key's outside of $env:UserProfile:
|
||||
TakeOwn /F $Key
|
||||
Icacls $Key /c /t /Grant:r ${env:UserName}:F
|
||||
|
||||
# Remove All Users, except for Owner:
|
||||
Icacls $Key /c /t /Remove:g Administrator "Authenticated Users" BUILTIN\Administrators BUILTIN Everyone System Users
|
||||
|
||||
# Verify:
|
||||
Icacls $Key
|
||||
|
||||
# Remove Variable:
|
||||
Remove-Variable -Name Key
|
Loading…
x
Reference in New Issue
Block a user