Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
acl [2024/09/17 14:57] jango [Windows] |
acl [2025/05/14 08:47] (aktuell) jango |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | Mit Hilfe von Access Control Lists (kurz ACL) ist es möglich, einzelnen Nutzern (oder auch Gruppen) gezielt Rechte an einzelnen Dateien bzw Diensten zu gewähren oder zu entziehen. | + | Mit Hilfe von Access Control Lists (kurz ACL) ist es möglich, einzelnen Nutzern (oder auch Gruppen) gezielt Rechte an einzelnen Dateien bzw Diensten zu gewähren oder zu entziehen. Siehe auch [[icacls]]. |
| ACLs werden aber auch auf [[switch|Switches]], | ACLs werden aber auch auf [[switch|Switches]], | ||
| Zeile 26: | Zeile 26: | ||
| <code powershell> | <code powershell> | ||
| - | Get-ACL " | + | ### Get ACL |
| - | Get-ACL " | + | |
| - | FileSystemRights | + | Write-Output " |
| - | AccessControlType : Allow | + | get-acl -path " |
| - | IdentityReference | + | |
| - | IsInherited | + | |
| - | InheritanceFlags | + | ### Modify ACL |
| - | PropagationFlags | + | |
| + | $NewAcl = Get-Acl -Path " | ||
| + | |||
| + | # Properties | ||
| + | $identity = " | ||
| + | $fileSystemRights = "FullControl" | ||
| + | $type = "Allow" | ||
| + | |||
| + | # Create new rule | ||
| + | $fileSystemAccessRuleArgumentList = $identity, $fileSystemRights, | ||
| + | $fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList | ||
| + | |||
| + | # Apply new rule | ||
| + | $NewAcl.SetAccessRule($fileSystemAccessRule) | ||
| + | Set-Acl -Path " | ||
| + | |||
| + | Write-Output "After Modify:" | ||
| + | get-acl -path " | ||
| + | |||
| + | ### Remove ACL | ||
| + | |||
| + | $Acl = Get-Acl -Path " | ||
| + | |||
| + | # Properties | ||
| + | $Identity = " | ||
| + | $FileSystemRights = [System.Security.AccessControl.FileSystemRights]:: | ||
| + | $AccessControlType = [System.Security.AccessControl.AccessControlType]:: | ||
| + | $InheritanceFlags | ||
| + | $PropagationFlags = [System.Security.AccessControl.PropagationFlags]::None | ||
| + | |||
| + | # Create rule to remove | ||
| + | $RuleToRemove = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $Identity, $FileSystemRights, | ||
| + | $Acl.RemoveAccessRule($RuleToRemove) | ||
| + | |||
| + | # Apply rule | ||
| + | Set-Acl -Path " | ||
| + | |||
| + | Write-Output "After Remove:" | ||
| + | get-acl -path " | ||
| </ | </ | ||
| Zeile 50: | Zeile 87: | ||
| * NoPropagateInherit: | * NoPropagateInherit: | ||
| * InheritOnly: | * InheritOnly: | ||
| + | |||
| + | ====Icacls==== | ||
| Auch [[Windows]] unterstützt granulare Berechtigungseinstellungen. | Auch [[Windows]] unterstützt granulare Berechtigungseinstellungen. | ||
| Zeile 66: | Zeile 105: | ||
| icacls filename /remove username | icacls filename /remove username | ||
| </ | </ | ||
| + | |||
| + | =====Links===== | ||
| + | |||
| + | * [[https:// | ||