Disable inherit on key file for parent ACL rules
This commit is contained in:
parent
ae8e25aabc
commit
e39b3555e6
|
@ -15,8 +15,10 @@ function Set-SSHKeyPermissions {
|
||||||
# Create the new ACL we want to apply
|
# Create the new ACL we want to apply
|
||||||
$NewAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
|
$NewAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
|
||||||
$Principal, "FullControl", "None", "None", "Allow")
|
$Principal, "FullControl", "None", "None", "Allow")
|
||||||
# Scrub all existing ACLs from the file
|
|
||||||
$ACL = Get-ACL "${SSHKeyPath}"
|
$ACL = Get-ACL "${SSHKeyPath}"
|
||||||
|
# Disable inherited rules
|
||||||
|
$ACL.SetAccessRuleProtection($true, $false)
|
||||||
|
# Scrub all existing ACLs from the file
|
||||||
$ACL.Access | %{$ACL.RemoveAccessRule($_)}
|
$ACL.Access | %{$ACL.RemoveAccessRule($_)}
|
||||||
# Apply the new ACL
|
# Apply the new ACL
|
||||||
$ACL.SetAccessRule($NewAccessRule)
|
$ACL.SetAccessRule($NewAccessRule)
|
||||||
|
|
Loading…
Reference in New Issue