【问题标题】:How to give access to a file only for particular user group?如何仅授予特定用户组对文件的访问权限?
【发布时间】:2014-02-18 02:10:28
【问题描述】:

我们正试图将一个 exe 的访问权限限制在一组用户中。

默认情况下,管理员也继承了访问权限。

如何删除对管理员的继承权并仅提供对用户组名称的访问权限,例如“特殊日志管理员”?

【问题讨论】:

  • 这个问题应该是关于Serverfault的。使用 Applocker。

标签: batch-file powershell powershell-2.0 acl


【解决方案1】:

看看这里http://technet.microsoft.com/en-us/library/ff730951.aspx和这里https://www.angryadmin.co.uk/?p=425

$colRights = [System.Security.AccessControl.FileSystemRights]"FullControl"

$InheritanceFlag = [System.Security.AccessControl.InheritanceFlags]::None
$PropagationFlag = [System.Security.AccessControl.PropagationFlags]::None

$objType =[System.Security.AccessControl.AccessControlType]::Allow

$objUser = New-Object System.Security.Principal.NTAccount("BUILTIN\Users")

$objACE = New-Object System.Security.AccessControl.FileSystemAccessRule `
    ($objUser, $colRights, $InheritanceFlag, $PropagationFlag, $objType)

$objACL = Get-ACL "C:\Scripts\Test.ps1"
$objACL.AddAccessRule($objACE)

#!!!Remove the parent folder inheritance and don't copy the previously inherited permissions.
$objAcl.SetAccessRuleProtection($true,$false)

Set-ACL "C:\Scripts\Test.ps1" $objACL

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-10
    • 1970-01-01
    • 2016-12-20
    • 1970-01-01
    • 2020-01-17
    • 2020-01-07
    • 2020-02-17
    相关资源
    最近更新 更多