如何在 Windows Server 2003 中使用命令行添加文件权限?

如何在 Windows Server 2003 中使用命令行添加文件权限?

我尝试在 Windows Server 2003 计算机上使用 xcacls 和 cacls,但它们都代替当我使用 /g 时,现有权限会被删除。有谁知道一个命令行工具可以简单地添加权限?

答案1

确保使用/G /E(编辑模式)一起(并且很可能还有/T)。

作为参考,以下是该命令的完整使用信息CACLS /?

CACLS filename [/T] [/E] [/C] [/G user:perm] [/R user [...]]
               [/P user:perm [...]] [/D user [...]]
   filename      Displays ACLs.
   /T            Changes ACLs of specified files in
                 the current directory and all subdirectories.
   /E            Edit ACL instead of replacing it.
   /C            Continue on access denied errors.
   /G user:perm  Grant specified user access rights.
                 Perm can be: R  Read
                              W  Write
                              C  Change (write)
                              F  Full control
   /R user       Revoke specified user's access rights (only valid with /E).
   /P user:perm  Replace specified user's access rights.
                 Perm can be: N  None
                              R  Read
                              W  Write
                              C  Change (write)
                              F  Full control
   /D user       Deny specified user access.
Wildcards can be used to specify more that one file in a command.
You can specify more than one user in a command.

Abbreviations:
   CI - Container Inherit.
        The ACE will be inherited by directories.
   OI - Object Inherit.
        The ACE will be inherited by files.
   IO - Inherit Only.
        The ACE does not apply to the current file/directory.

答案2

您还可以尝试使用 helgeklein.com 提供的名为 SetACL.exe 的工具。非常强大的工具,试试看。

答案3

如果你看了 CACLS,别忘了看看 ICACLS

相关内容