SubInAcl版本号 5.2.3790.1180 是此工具的一特定版本,代表它是 Windows Server 2003 和 Windows XP 环境中常见的一版本。 SubInAcl、icacls 和 PowerShell 的命令,它们在文件和文件夹权限管理方面也有一些区别。下面是这三者的对比表:

下载

 

SubInAcl 5.2.3790.1180 版本(注:尝试翻译中文,如有错误,请指正,欢迎喷饭)

使用方法

语法:
SubInAcl [/选项...] /对象类型 对象名称 [[/操作[=参数]...]

选项:
/outputlog=文件名 /errorlog=文件名
/noverbose /verbose(默认)
/notestmode(默认) /testmode
/alternatesamserver=SAM服务器 /offlinesam=文件名
/stringreplaceonoutput=字符串1=字符串2
/expandenvironmentsymbols(默认) /noexpandenvironmentsymbols
/statistic(默认) /nostatistic
/dumpcachedsids=文件名 /separator=字符
/applyonly=[dacl,sacl,owner,group]
/nocrossreparsepoint(默认) /crossreparsepoint

对象类型:
/service(服务) /keyreg(注册表键) /subkeyreg(注册表子键)
/file(文件) /subdirectories[=directoriesonly|filesonly](子目录[=仅目录|仅文件])
/clustershare(集群共享) /kernelobject(内核对象) /metabase(元数据库)
/printer(打印机) /onlyfile(仅文件) /process(进程)
/share(共享) /samobject(SAM对象)

操作:
/display[=dacl|sacl|owner|primarygroup|sdsize|sddl](显示[=自主访问控制列表|系统访问控制列表|所有者|主组|安全描述符大小|安全描述符定义语言])(默认)
/setowner=所有者(设置所有者)
/replace=[域名]旧账户=[域名]新账户(替换)
/accountmigration=[域名]旧账户=[域名]新账户(账户迁移)
/changedomain=旧域名=新域名[=映射文件[=两者]](更改域)
/migratetodomain=源域=目标域[=映射文件[=两者]](迁移到域)
/findsid=[域名]账户[=停止|继续](查找安全标识符)
/suppresssid=[域名]账户(排除安全标识符)
/confirm(确认)
/ifchangecontinue(若更改则继续)
/cleandeletedsidsfrom=域名[=dacl|sacl|owner|primarygroup|all](从域中清理已删除的安全标识符)
/testmode(测试模式)
/accesscheck=[域名]用户名(访问检查)
/setprimarygroup=[域名]组(设置主组)
/grant=[域名]用户名[=权限](授予)
/deny=[域名]用户名[=权限](拒绝)
/sgrant=[域名]用户名[=权限](特殊授予)
/sdeny=[域名]用户名[=权限](特殊拒绝)
/sallowdeny==[域名]用户名[=权限](特殊允许拒绝)
/revoke=[域名]用户名(撤销)
/perm(权限)
/audit(审核)
/compactsecuritydescriptor(压缩安全描述符)
/pathexclude=模式(路径排除)
/objectexclude=模式(对象排除)
/sddl=安全描述符定义语言字符串
/objectcopysecurity=对象路径(对象复制安全性)
/pathcopysecurity=路径容器(路径复制安全性)

语法:SubInAcl [/选项...] /playfile 文件名(播放文件)

语法:SubInAcl /help [关键字](帮助)
SubInAcl /help /full(完整帮助)
关键字可以是:
features(功能) usage(用法) syntax(语法) sids(安全标识符) view_mode(查看模式) test_mode(测试模式) object_type(对象类型)
domain_migration(域迁移) server_migration(服务器迁移) substitution_features(替换功能) editing_features(编辑功能)
或
任意 [/选项] [/操作] [/对象类型]

语法说明

描述 SubInAcl 语法

SubInAcl 的语法类似于 UNIX 的 find 工具。
对于每个对象,SubInAcl:
1. 检索对象的安全描述符
2. 应用 /操作。操作按命令行顺序执行
3. 如果:
- 安全描述符已被修改且
- 未指定 /testmode 开关
则将更改应用到对象
例如:
- SubInAcl /outputlog=result.txt /subdirectories \Server\c$\temp*.*
/grant=Dom\John=F /noverbose /display
对于 \Server\c$\temp 下的每个文件,SubInAcl 将
- 打开文件
- 授予 dom\john 完全控制权限
- 以非详细模式显示安全设置
- 保存安全描述符
所有输出将保存到 result.txt

您可以指定任意数量的 /操作。每个操作必须至少指定 3 个字符。
命令行不区分大小写

例如:SubInAcl /file c:\temp*.txt /replace=John=Smith /display
对于每个 *.txt 文件,将 - 把 John 替换为 Smith
- 显示整个安全描述符
- 如有更改则应用更改

SubInAcl 错误消息发送到标准错误。
您可以使用 /output 开关将输出和错误保存到同一文件。

功能特性

描述 SubInAcl 主要功能
SubInAcl 旨在帮助管理员管理各种对象的安全性。
它提供:

统一的方式来操作不同类型对象(文件、注册表键、服务、打印机等)的安全性

控制台工具,允许编写脚本来自动化安全任务

一些功能可帮助管理员在组织发生变化时修改安全性:
- 用户、组删除(/suppresssid, /cleandeletedsidsfrom)
- 用户、组迁移(/replace, /accountmigration)
- 域、服务器迁移(/changedomain, /migratetodomain)
...

安全描述符编辑功能:
- 所有者(/setowner)
- 主组(/setprimarygroup)
- 权限(/grant, /deny, /revoke)
- 审核(/sgrant, /sdeny, /sallowdeny)

访问远程对象

保存和恢复权限(/playfile, /outputlog, /display)

运行此工具需要 SeBackupPrivilege SeRestorePrivilege
SeSecurityPrivilege SeTakeOwnershipPrivilege
SeChangeNotifyPrivilege 权限(本地或远程)

输入 SubInAcl /help 获取扩展帮助

安全标识符 (SIDS)

SIDS:说明 SubInAcl 如何检索和转换 SID

安全描述符使用 SID(安全标识符)引用用户和组。SID 可以用以下形式表示:
+ 域名\账户(例如:DOM\Administrators)
+ 独立服务器\组
+ 账户(参见 LookupAccount API)
+ s-1-x-x-x-x(x 以十进制表示)
(例如:S-1-5-21-56248481-1302087933-1644394174-1001)
警告:这种情况下,不检查此 SID 是否存在

SubInAcl 维护本地 SID 缓存,以最小化 SID 到"可读名称"转换的网络成本。

SubInAcl 查询资源对象所在的服务器来转换或检索 SID。如果需要,您可以指定另一个 SAM 服务器来转换 SID(参见 /alternatesamserver)。
如果您尝试替换 SID 且源域或服务器不在线,您可以提供一个包含所需 SID 的文件(参见 /offlinesam)。
您可以将本地 SID 缓存转储到文件中(参见 /dumpcachedsids)。

查看模式

/noverbose /verbose

SubInAcl 可以在安静模式(/noverbose)或详细模式(/verbose, /Noverbose)下使用。
您可以在以下位置指定这些开关:

整个命令行:
SubInAcl /noverbose /file *.dat /display

特定操作之后:
SubInacl /file *.dat /display /noverbose /display

测试模式

/testmode /notestmode(默认)

如果指定了 /testmode,更改将不会反映到对象安全描述符。此选项可用于测试命令的有效性。
例如:SubInacl /subdirec \server\share*.* /changedomain=DOMA=DOMB
/ifchangecontinue /noverbose /display /testmode
对于每个修改的文件,此命令显示修改后的安全描述符。但这些更改不会实际应用到文件

对象类型

/file /subdirectories /onlyfile /keyreg /subkeyreg /service /share /clustershare /printer
/kernelobject /metabase /process /samobject

SubInAcl 可以处理各种对象:

文件:
/file
/subdirectories
/onlyfile

注册表键:
/keyreg
/subkeyreg

服务:
/service

共享:
/share
/clustershare

打印机:
/printer

内核命名对象:
/kernelobject

IIS 管理权限:
/metabase

进程:
/process

SAM:
/SamObject

操作对所有对象都有效
大多数对象支持使用 * 字符进行枚举

域迁移

说明如何在域 SID 之间迁移安全性

SubInAcl 的主要目的是在域架构发生变化时帮助管理员迁移用户。
例如,用户 John 已移动,现在是 DOMB 域的成员。您可以通过以下方式反映此更改:
SubInAcl /subdirec \server\share*.* /replace=OldDomain\John=DOMB\John
注意:必须在服务器域与 OldDomain 和 NEWDOMAIN 之间启用信任关系
注意:如果无法启用信任关系,您可以使用 /alternatesamserver=Server。Server 应为域控制器服务器的名称

示例:
您一直使用单个域工作。
您想要将名为 MIGRCONTROL 的 BDC 及其所有文件和使用的用户迁移到新域

将 BDC 重新安装为 NEWDOMAIN 的 PDC(不擦除文件)

在 NEWDOMAIN 上创建用户

与 OLDDOMAIN 创建"信任关系"

运行 SubInAcl /noverbose /subdirectories x:*.*
/changedomain=OLDDOMAIN=NEWDOMAIN

使用 SubInAcl /noverbose /subdirectories x:*.* 验证更改

示例:
您在工作组环境中使用名为 SERVER 的独立服务器工作。您想将此服务器(包括用户)移动到域 DOM。

将 SERVER 移动到 DOM 域

在 DOM 域中创建用户

SubInAcl /noverbose /subdirectories \server\share
/changedomain=SERVER=DOM

参见 /changedomain /migratedomain /replace 操作

服务器迁移

说明当对象从一台服务器移动到另一台服务器时如何迁移 SID

将文件系统从一台本地服务器迁移到另一台本地服务器并非易事。SubInAcl 版本 2.2 已增强以帮助此迁移过程。
要将文件系统文件从一台本地服务器迁移并保留安全性,您可以执行以下步骤:

使用 scopy 将文件和 ACL 复制到目标服务器

在目标服务器上创建本地组

使用 /changedomain 或带 /alternatesamserver 选项的 /changedomain:
默认情况下,SubInAcl 查询对象所在的服务器以检索 SID。此服务器不知道另一台独立服务器上有效的 SID
为了解决此问题,您可以使用 /alternatesamserver 选项要求 SubInAcl 在初始服务器上 SID 解析不成功时使用备用 SAM 服务器。
示例:
SubInAcl /alternatesamserver=SourceServer /subdirect
\DestServer\Share*.*
/migratedomain=SourceServer=DestServer

参见 /alternatesamserver /migratedomain /offlinesam

编辑功能

如何编辑安全描述符的各个部分

SubInAcl 允许修改安全描述符的每个部分:

所有者
参见 /owner=SID 或 /setowner=SID

主组
参见 /setprimarygroup=GroupSID

系统 ACL(SubInAcl 名称 = 审核 ACL)和访问控制条目(SubInAcl 名称= AAce = 审核 ACE)
参见 /audit /sgrant /sdeny /sallowdeny

自由访问控制列表(SubInAcl 名称 = 权限 ACL)和访问控制条目(SubInAcl 名称= PAce = 权限 ACE)
参见 /perm /pace=xxx /revoke=SID /grant=SID=Access /deny=SID=access
/sgrant=SID=Access /sdeny=SID=access
/sallowdeny=SID=access

或完整的安全描述符
参见 /sddl=sddl_string

/服务

/service 服务名称

操作服务

\服务器名\Messenger

\服务器名\M*

Messenger
注意:也可以使用 /driver。
/driver * 将显示所有驱动程序
/service * 将显示所有服务

/注册表键

/keyreg 注册表键

操作注册表键

HKEY_CURRENT_USER\Software

HKEY_CURRENT_USER\Software*Version

\服务器\HKEY_LOCAL_MACHINE\键路径

/注册表子键

/subkeyreg 注册表键

操作注册表键和子键

HKEY_CURRENT_USER\Software

HKEY_CURRENT_USER\Software*Version

\服务器\HKEY_LOCAL_MACHINE\键路径

/文件

/file 文件名

操作文件
注意:SubInAcl 不支持 DFS 卷

*.obj

c:\temp*.obj

\服务器名\共享*.exe

c:
/file=directoriesonly 将仅对目录应用参数
/file=filesonly 将仅对文件应用参数

/子目录

/subdirectories 文件路径

操作指定目录和所有子目录中的文件

c:\temp*.obj:处理所有 obj 文件

c:\temp\test:处理 c:\temp 目录下的所有 test 文件

c:\temp\test*.*:处理 temp\test 下的所有文件

c:\temp\test\:处理 temp\test 下的所有文件
/subdirectories=directoriesonly 将仅对目录应用参数
/subdirectories=filesonly 将仅对文件应用参数

/仅文件

/onlyfile 文件名

不使用 FindFilexxx 机制打开文件。
可用于访问命名管道或邮件槽

\.\pipe\管道名

/SAM对象

/samobject sam对象

允许访问与 SAM 对象(用户、本地组、全局组)关联的 ACL。
可用于允许由成员服务器上的高级用户创建的本地组(别名)被另一个高级用户成员更新

\sam服务器\本地组

\sam服务器*用户*

组

Subinacl /samobject \sams\testgroup /grant=poweruser1=f

/共享

/share 文件共享名称

访问网络文件共享。

\服务器\共享

\服务器\测试*

/集群共享

/clustershare \集群名\文件共享资源

访问集群文件共享资源。

\集群名\文件共享_资源_名称

\集群名\s*

/内核对象

/kernelobject 内核对象名称

访问命名内核对象。
可用于查看互斥体、节、事件对象

/进程

/process 进程ID或可执行文件模式

访问进程对象。

notepad.* 或十进制进程ID

/元数据库

/metabase 元数据库路径

访问 IIS 元数据库 AdminACL 元数据库属性
请注意,此属性只能用于以下元数据库路径:
/LM/MSFTPSVC, /LM/MSFTPSVC/n, /LM/W3SVC, /LM/W3SVC/
此对象不支持枚举。

SubInAcl /metabase \服务器名\LM\W3SVC /grant=administrator=F

/打印机

/printer 打印机名称

访问打印机

\服务器\打印机1

\服务器*

/显示

/display[=dacl|sacl|owner|primarygroup|sdsize|sddl]

显示安全描述符
您还可以查看安全描述符的部分内容。/display=dacl 将显示自由访问控制列表。/display=sddl 将使用 Win32 SDDL 安全描述符字符串格式显示安全性(参见 Platform SDK)
/noverbose 显示可用于重新应用安全描述符(参见 /playfile)

/播放文件

/playfile 播放文件

/播放文件功能允许 SubInacl 在批处理模式下运行。
播放文件命令文件的格式为:

对象类型 对象名称
/操作[=参数]...
/操作[=参数]...
+对象类型 对象名称
/操作[=参数]...

SubInacl /playfile=playfile.txt
播放文件内容:
+subdirec *.txt
/grant=everyone=R
+service RkillSrv
/display
将给出与以下相同的结果:
SubInAcl /subdirectories *.txt /grant=everyone=R
SubInAcl /service RkillSrv /display

播放文件功能的一个典型用法是允许重新应用先前保存的安全设置,因为 noverbose /display 的输出格式是播放文件兼容格式:
1.a) SubInAcl /noverbose /outputlog=d:\SubInaclSave.txt /subdirectories c:*.* /display
此命令保存 C: 驱动器上所有文件的安全设置。
SID 将以域\用户字符串格式保存
noverbose 模式下的 /display 选项使用播放文件兼容的输出格式
或
1.b) SubInAcl /error=d:\Err.txt /outputlog=d:\SubInaclSave.txt /subdirectories c:*.* /display=sddl
此命令使用 Win32 SDDL 格式保存所有安全设置。
SID 将以 S-1-x-x 形式保存。这将不需要 SubInacl 转换 SID
这可能会减少运行时间和资源使用
2) SubInAcl /playfile d:\SubInaclSave.txt
此命令将重新应用先前保存的设置。

使用播放文件的另一个优点是提高性能并节省网络带宽,因为 SubInacl 维护本地 SID 缓存。
例如,如果您发出:
SubInacl /subdirectories c:*.* /migrate=domain1=domain2
和
SubInacl /subdirectories d:*.* /migrate=domain1=domain2

批处理这些命令将减少网络带宽使用并提高性能,因为 SID 到可读名称的解析过程将减少。

/输出日志

/outputlog=文件名

所有输出将发送到文件名。您需要使用 /errlog 开关将错误重定向到不同的文件

/错误日志

/errorlog=文件名.txt

所有错误将发送到文件名.txt

/备用SAM服务器

/alternatesamserver=服务器

SubInAcl 查询对象所在的服务器以查找 SID。
在某些情况下,您可能需要(参见 server_migration 或 domain_migration)从另一台服务器检索 SID。如果 SID 解析不成功,此选项允许 SubInAcl 查询备用 SAM 服务器。

/离线SAM

/offlinesam=文件名

默认情况下,SubInAcl 查询对象所在的服务器以查找 SID。在某些情况下(源服务器离线或域不再可用,希望避免 SID 检索的网络往返),您可以允许 SubInAcl.exe 从文件名文件中检索 SID。
文件格式为:
cachefileonly=s-1-9-cacheonly
域\simon=S-1-5-21-1190502449-1716722630-1654032285-1105
nat\julien=S-1-5-21-1060284298-436374069-1708537768-1005

其中 domain\simon 和 nat\julien 可以是域账户或服务器账户。
如果文件中有 cachefileonly 行,SubInAcl.exe 将不再查询 SAM 服务器。所有需要的 SID 都应在 SAM 缓存文件中找到

/转储缓存SID

/dumpcachedsids=文件名

在 subinacl 执行结束时,您可以将本地缓存 SID 的内容转储到文件中。
此文件可用于未来的 SubInacl 执行(参见 /offlinesam)以加速 SID 解析过程)

/设置所有者

/setowner=SID

将更改对象的所有者
/owner=SID 或 /setowner=SID
owner = 域名\Administrators 将在对象所在的服务器上检索 Administrators 的 SID(参见 Win32 SDK LookupAccountName 函数)。

/替换

/replace=域名\旧账户=域名\新账户

text
替换对象中的所有 ACE(审核和权限)
例如:/replace=DOM_MARKETING\ChairMan=NEWDOM\NewChairMan 将
      将所有包含 DOM_MARKETING\ChairMan 的 ACE 替换为从 NEWDOM 域检索的 NewChairMan SID
警告:如果 DomainName\New_Account 已有一个 ACE,则跳过 ACE 替换
/账户迁移

/accountmigration=域名\旧账户=域名\新账户

text
(参见 /replace)
将:
- 如果所有者或主组是 DomainName\OldAccount,则替换它们
- 为 New_Account 复制引用 DomainName\OldAccount 的 ACE
例如:/accountmigration=DOM_MARKETING\ChairMan=NEWDOM\NewChairMan 将
      复制所有包含 DOM_MARKETING\ChairMan 的 ACE,并使用从 NEWDOM 域检索的 NewChairMan SID
警告:如果 DomainName\New_Account 已有一个 ACE,则跳过 ACE 替换
/清理已删除SID

/cleandeletedsidsfrom=域[=dacl|sacl|owner|primarygroup|all]

text
删除包含来自 DomainName 的已删除(无效)SID 的所有 ACE
您可以指定要扫描安全描述符的哪个部分(默认=全部)
如果所有者已删除,新所有者将是 Administrators 组。
如果主组已删除,新主组将是 Users 组。
/更改域

/changedomain=旧域名=新域名[=映射文件[=两者]]

text
 将所有带有来自 OldDomainName 的 SID 的 ACE 替换为在 NewSamServer 中找到的等效 SID
 例如:/changedomain=DOM_MARKETING=NEWDOMAIN
 替换所有包含 DOM_MARKETING\ChairMan SID 的 ACE
 为在 NEWDOMAIN 计算机上检索到的 ChairMan 的 SID
 NEWDOMAIN 必须与包含对象的服务器具有信任关系

 如果您想明确指定受影响的用户,您可以指定一个映射文件。MappingFile 文件将允许您指定受影响的用户列表以及 NewDomain 中的替换用户名称

 以下是 MappingFile 的示例

 simon=julien
 administrator=administrator

 OldDomainName\Simon 将被 NewDomainName\Julien 替换,并且
 OldDomainName\Administrator 将被替换为
 NewDomainName\Administrator

 如果您使用 /changedomain=OldDomainName=NewDomainName=MappingFile 表示法,则仅迁移此文件中定义的用户。
 如果您使用 /changedomain=OldDomainName=NewDomainName=MappingFile=Both,将首先检查映射文件以确定是否存在映射用户。如果不存在,SubInacl 将尝试在 NewDomainName 中找到等效用户
/迁移到域

/migratetodomain=源域名=目标域名[=映射文件[=两者]]

text
 与 /changedomain 行为相同,只是将添加新的 ACE 而不是替换
 例如:/migratetodomain=DOM1=DOM2
 每个带有 DOM1\User 的 ace 将被复制为 DOM2\User
 (如果 DOM2\User 存在)
 如果在迁移过程中出现严重疏忽,您可以指示用户重新登录到 DOM1。
 注意:所有者和主组将迁移到 DOM2
/查找SID

/findsid=域名\账户[=停止|继续]

text
 显示安全描述符中包含对 DomainName\Account 引用的对象名称
 stop     - 如果找到 Account,将跳过后续参数且不应用更改
          - 如果未找到 Account,将执行下一个参数
 continue - 如果找到 Account,将执行后续参数
          - 如果未找到 Account,将跳过后续参数且不应用更改
/排除SID

/suppresssid=域名\账户

text
 抑制所有包含 DomainName\Account SID 的 ACE。
 如果对象的所有者是 DomainName\Account,则所有者设置为 Everyone 的 SID。
/权限

/perm

text
 抑制所有现有的权限 ace(PACE)
/审核

/audit

text
 抑制所有现有的审核 ace(AACE)
/如果更改则继续

/ifchangecontinue

text
 仅当先前操作中进行了某些更改时才继续处理后续操作
/测试模式

/testmode

text
 更改将不会应用到对象。这允许测试修改
/访问检查

/accesscheck=域\用户名

text
 显示授予域\用户名的访问权限。将询问密码。此选项需要 SeTcbName 特权(作为操作系统的一部分)。此选项不能用于远程对象。
 注意:访问权限是使用授予域\用户名的 NETWORK 安全标识检查的
/设置主组

/setprimarygroup=[域名]组

text
 更改主组
/拒绝

/deny=[域名]用户[=权限]

text
 为指定用户(或组)添加拒绝权限 Ace
      如果未指定权限,则拒绝所有访问。

 文件:
   F:完全控制
   C:更改
   R:读取
   P:更改权限
   O:取得所有权
   X:执行
   E:读取执行
   W:写入
   D:删除

 集群共享:
   F:完全控制
   R:读取
   C:更改

 打印机:
   F:完全控制
   M:管理文档
   P:打印

 注册表键:
   F:完全控制
   R:读取
   A:读取控制
   Q:查询值
   S:设置值
   C:创建子键
   E:枚举子键
   Y:通知
   L:创建链接
   D:删除
   W:写入 DAC
   O:写入所有者

 服务:
   F:完全控制
   R:一般读取
   W:一般写入
   X:一般执行
   L:读取控制
   Q:查询服务配置
   S:查询服务状态
   E:枚举依赖服务
   C:服务更改配置
   T:启动服务
   O:停止服务
   P:暂停/继续服务
   I:查询服务
   U:服务用户定义控制命令

 共享:
   F:完全控制
   R:读取
   C:更改

 元数据库:
   F:完全控制
   R:读取 - MD_ACR_READ
   W:写入 - MD_ACR_WRITE
   I:受限写入 - MD_ACR_RESTRICTED_WRITE
   U:不安全属性读取 - MD_ACR_UNSECURE_PROPS_READ
   E:枚举键 - MD_ACR_ENUM_KEYS
   D:写入 DAC - MD_ACR_WRITE_DAC

 进程:
   F:完全控制
   R:读取
   W:写入
   X:执行

 SamObject:
   F:完全控制
   W:写入
   R:读取
   X:执行
/撤销

/revoke=[域名]用户

text
 抑制指定用户(或组)的所有权限 Ace
/授予

/grant=[域名]用户[=权限]

text
 将为用户添加权限 Ace。
 如果未指定权限,将授予完全控制访问权限。

 文件:
   F:完全控制
   C:更改
   R:读取
   P:更改权限
   O:取得所有权
   X:执行
   E:读取执行
   W:写入
   D:删除

 集群共享:
   F:完全控制
   R:读取
   C:更改

 打印机:
   F:完全控制
   M:管理文档
   P:打印

 注册表键:
   F:完全控制
   R:读取
   A:读取控制
   Q:查询值
   S:设置值
   C:创建子键
   E:枚举子键
   Y:通知
   L:创建链接
   D:删除
   W:写入 DAC
   O:写入所有者

 服务:
   F:完全控制
   R:一般读取
   W:一般写入
   X:一般执行
   L:读取控制
   Q:查询服务配置
   S:查询服务状态
   E:枚举依赖服务
   C:服务更改配置
   T:启动服务
   O:停止服务
   P:暂停/继续服务
   I:查询服务
   U:服务用户定义控制命令

 共享:
   F:完全控制
   R:读取
   C:更改

 元数据库:
   F:完全控制
   R:读取 - MD_ACR_READ
   W:写入 - MD_ACR_WRITE
   I:受限写入 - MD_ACR_RESTRICTED_WRITE
   U:不安全属性读取 - MD_ACR_UNSECURE_PROPS_READ
   E:枚举键 - MD_ACR_ENUM_KEYS
   D:写入 DAC - MD_ACR_WRITE_DAC

 进程:
   F:完全控制
   R:读取
   W:写入
   X:执行

 SamObject:
   F:完全控制
   W:写入
   R:读取
   X:执行
/特殊允许拒绝

/sallowdeny=[域名]用户[=权限]

text
 将为用户添加允许/失败审核 Ace,并删除此用户(或组)的所有现有审核 Ace。
 如果未指定权限,将使用完全控制访问掩码。
 例如:SubInacl /file c:\windows\explorer.exe /sallowdeny=everyone=R
      将为每个人的成功和失败访问设置审核
/特殊授予

/sgrant=[域名]用户[=权限]

text
 将为用户添加成功(允许)审核 Ace,并删除此用户(或组)的所有现有审核 Ace。
 如果未指定权限,将使用完全控制访问掩码。
 例如:SubInacl /file c:\windows\explorer.exe /sgrant=everyone=R
      将为每个人的成功访问设置审核

 文件:
   F:完全控制
   C:更改
   R:读取
   P:更改权限
   O:取得所有权
   X:执行
   E:读取执行
   W:写入
   D:删除

 集群共享:
   F:完全控制
   R:读取
   C:更改

 打印机:
   F:完全控制
   M:管理文档
   P:打印

 注册表键:
   F:完全控制
   R:读取
   A:读取控制
   Q:查询值
   S:设置值
   C:创建子键
   E:枚举子键
   Y:通知
   L:创建链接
   D:删除
   W:写入 DAC
   O:写入所有者

 服务:
   F:完全控制
   R:一般读取
   W:一般写入
   X:一般执行
   L:读取控制
   Q:查询服务配置
   S:查询服务状态
   E:枚举依赖服务
   C:服务更改配置
   T:启动服务
   O:停止服务
   P:暂停/继续服务
   I:查询服务
   U:服务用户定义控制命令

 共享:
   F:完全控制
   R:读取
   C:更改

 元数据库:
   F:完全控制
   R:读取 - MD_ACR_READ
   W:写入 - MD_ACR_WRITE
   I:受限写入 - MD_ACR_RESTRICTED_WRITE
   U:不安全属性读取 - MD_ACR_UNSECURE_PROPS_READ
   E:枚举键 - MD_ACR_ENUM_KEYS
   D:写入 DAC - MD_ACR_WRITE_DAC

 进程:
   F:完全控制
   R:读取
   W:写入
   X:执行

 SamObject:
   F:完全控制
   W:写入
   R:读取
   X:执行
/特殊拒绝

/sdeny=[域名]用户[=权限]

text
 将为用户添加失败审核 Ace,并删除此用户(或组)的所有现有审核 Ace。
 如果未指定权限,将使用完全控制访问掩码。

 文件:
   F:完全控制
   C:更改
   R:读取
   P:更改权限
   O:取得所有权
   X:执行
   E:读取执行
   W:写入
   D:删除

 集群共享:
   F:完全控制
   R:读取
   C:更改

 打印机:
   F:完全控制
   M:管理文档
   P:打印

 注册表键:
   F:完全控制
   R:读取
   A:读取控制
   Q:查询值
   S:设置值
   C:创建子键
   E:枚举子键
   Y:通知
   L:创建链接
   D:删除
   W:写入 DAC
   O:写入所有者

 服务:
   F:完全控制
   R:一般读取
   W:一般写入
   X:一般执行
   L:读取控制
   Q:查询服务配置
   S:查询服务状态
   E:枚举依赖服务
   C:服务更改配置
   T:启动服务
   O:停止服务
   P:暂停/继续服务
   I:查询服务
   U:服务用户定义控制命令

 共享:
   F:完全控制
   R:读取
   C:更改

 元数据库:
   F:完全控制
   R:读取 - MD_ACR_READ
   W:写入 - MD_ACR_WRITE
   I:受限写入 - MD_ACR_RESTRICTED_WRITE
   U:不安全属性读取 - MD_ACR_UNSECURE_PROPS_READ
   E:枚举键 - MD_ACR_ENUM_KEYS
   D:写入 DAC - MD_ACR_WRITE_DAC

 进程:
   F:完全控制
   R:读取
   W:写入
   X:执行

 SamObject:
   F:完全控制
   W:写入
   R:读取
   X:执行
/对象排除

/objectexclude=模式

text
  所有匹配模式字符串的对象将被跳过(排除)。
       唯一有效的通配符是 *。它可以在字符串中的任何位置使用。
  模式可以是名称(*Name.exe)或路径(*dir\subdir\*ToExclude*)。
/路径排除

/pathexclude=模式

text
  所有匹配模式字符串的容器将不会被枚举。
  参见 /objectexclude
  注意:指定的操作也不会应用于容器。
/统计

/statistic

text
  处理完成后将显示统计信息。
/跨越重新解析点

/crossreparsepoint

text
  处理文件系统路径时,SubInacl 将枚举重新解析点下的文件和目录,除非指定了 /nocrossreparsepoint。
/输出字符串替换

/stringreplaceonoutput=字符串1=字符串2

text
  SubInAcl 输出中所有出现的字符串1将被字符串2替换。
/SDDL

/sddl=sddl_string

text
  使用 Win32 安全描述符定义语言(SDDL)为对象指定安全描述符
/仅应用

/applyonly=dacl,sacl,owner,group

text
  某些 subinacl 选项可能会更改安全描述符的部分(所有者、组、dacl、sacl)。
  您可以仅将更改限制在安全描述符的某些部分。
  例如 /applyonly=dacl,sacl,owner 将不会修改主组字段
/路径复制安全性

/pathcopysecurity=路径容器

text
  SubInacl 将使用容器路径中同名的对象重置对象的安全描述符。
  例如:- SubInacl /file c:\temp\*.txt /pathcopysecurity=d:\test
      将用从 d:\test\1.txt 检索的安全性替换 c:\temp\1.txt 的安全性(如果此文件存在)
      -SubInacl /service Messenger /pathcopysecurity=\\Server
      将使用远程 Messenger 服务上存在的安全性更新服务 Messenger 上的安全性
/对象复制安全性

/objectcopysecurity=对象路径

text
  SubInacl 将使用容器路径中的对象 object_path 重置安全描述符。
  例如:- SubInacl /file c:\temp\*.txt /objectcopysecurity=d:\test\mask.txt
      将用从 d:\test\amsk.txt 检索的安全性替换 c:\temp 中所有 txt 文件的安全性
      将使用远程 Messenger 服务上存在的安全性更新服务 Messenger 上的安全性

C:\Users\Administrator\Downloads\subinacl>subinacl /help /full
SubInAcl version 5.2.3790.1180

USAGE
-----

Usage :
     SubInAcl [/option...] /object_type object_name [[/action[=parameter]...]

 

 /options    :
    /outputlog=FileName                 /errorlog=FileName
    /noverbose                          /verbose (default)
    /notestmode (default)               /testmode
    /alternatesamserver=SamServer       /offlinesam=FileName
    /stringreplaceonoutput=string1=string2
    /expandenvironmentsymbols (default) /noexpandenvironmentsymbols
    /statistic (default)                /nostatistic
    /dumpcachedsids=FileName            /separator=character
    /applyonly=[dacl,sacl,owner,group]
    /nocrossreparsepoint (default)      /crossreparsepoint

 /object_type :
    /service            /keyreg             /subkeyreg
    /file               /subdirectories[=directoriesonly|filesonly]
    /clustershare       /kernelobject       /metabase
    /printer            /onlyfile           /process
    /share              /samobject

 /action      :
    /display[=dacl|sacl|owner|primarygroup|sdsize|sddl] (default)
    /setowner=owner
    /replace=[DomainName\]OldAccount=[DomainName\]New_Account
    /accountmigration=[DomainName\]OldAccount=[DomainName\]New_Account
    /changedomain=OldDomainName=NewDomainName[=MappingFile[=Both]]
    /migratetodomain=SourceDomain=DestDomain=[MappingFile[=Both]]
    /findsid=[DomainName\]Account[=stop|continue]
    /suppresssid=[DomainName\]Account
    /confirm
    /ifchangecontinue
    /cleandeletedsidsfrom=DomainName[=dacl|sacl|owner|primarygroup|all]
    /testmode
    /accesscheck=[DomainName\]Username
    /setprimarygroup=[DomainName\]Group
    /grant=[DomainName\]Username[=Access]
    /deny=[DomainName\]Username[=Access]
    /sgrant=[DomainName\]Username[=Access]
    /sdeny=[DomainName\]Username[=Access]
    /sallowdeny==[DomainName\]Username[=Access]
    /revoke=[DomainName\]Username
    /perm
    /audit
    /compactsecuritydescriptor
    /pathexclude=pattern
    /objectexclude=pattern
    /sddl=sddl_string
    /objectcopysecurity=object_path
    /pathcopysecurity=path_container

Usage  : SubInAcl   [/option...] /playfile file_name

Usage  : SubInAcl   /help [keyword]
         SubInAcl   /help /full
    keyword can be :
    features  usage syntax sids  view_mode test_mode object_type
    domain_migration server_migration substitution_features editing_features
         - or -
    any [/option] [/action] [/object_type]


SYNTAX
------

describe SubInAcl syntax

The SubInAcl syntax is analog to the UNIX find tool.
For each object, SubInAcl :
    1. retrieves the security descriptor of the object
    2. applies the /action(s). The /actions are executed in the order of
       the command line
    3. If :
       - the security descriptor has been modified and
       - the /testmode switch has not been specified
       the changes are applied to the object
    For instance :
       - SubInAcl /outputlog=result.txt /subdirectories \\Server\c$\temp\*.*
                  /grant=Dom\John=F /noverbose /display
         For each file below \\Server\c$\temp, SubInAcl will
         - open the file
                  - grant full control for dom\john
         - display the security setting in noverbose mode
         - save the security descriptor.
         All outputs will be saved in result.txt

You can specify as many /actions as you wish. You must specify at least 3
characters for each action.
The command line is not case-sensitive

Ex: SubInAcl /file c:\temp\*.txt /replace=John=Smith /display
    for each *.txt file will - replace John with Smith
                             - display the whole security descriptor
                             - apply the changes if any

SubInAcl error messages are sent to the Standard error.
You can use the /output switch to save both outputs
and errors in the same file.


FEATURES
--------

describes SubInAcl main features
SubInAcl was designed to help administrators to manage security on
various objects.
It provides :
   - a unified way to manipulate security for different kinds of objects
     (files, registry keys, services, printer,...)
   - a console tool that allows to write scripts to automate
     security tasks
   - some features that help administrators to modify security if some
     changes occur in their organization:
         - user, group deletions (/suppresssid, /cleandeletedsidsfrom )
         - user, group migrations (/replace , /accountmigration)
         - domain, server  migration (/changedomain, /migratetodomain)
         ...
   - security descriptor editing features :
         - owner ( /setowner )
         - primary group ( /setprimarygroup )
         - permissions ( /grant , /deny , /revoke )
         - audit ( /sgrant, /sdeny, /sallowdeny)
   - access to remote objects
   - save and restore permissions (/playfile , /outputlog , /display )

You need SeBackupPrivilege SeRestorePrivilege
SeSecurityPrivilege SeTakeOwnershipPrivilege
SeChangeNotifyPrivilege privileges (locally or remotely) to run this tool

Type SubInAcl /help to get extended help

 


SIDS
----

sids : explain how SubInAcl retrieves and translates SIDs

The security descriptor references users and groupswith a SID (Security
Identifier). A SID can be expressed in one of the following form:
         + DomainName\Account (ex: DOM\Administrators )
         + StandaloneServer\Group
         + Account ( see LookupAccount API )
         + s-1-x-x-x-x . x is expressed in decimal
           (ex: S-1-5-21-56248481-1302087933-1644394174-1001)
           Warning : In that case, no check is done to verify the existence
           of this SID.

SubInAcl maintains a local cache of SIDs to minimize SID to "Human Name"
translation network cost.

SubInAcl queries the server where the ressource object is located to
translate or retrieve SIDs. If needed, you can specify another SAM
server to translate SIDs (see /alternatesamserver).
If you try to replace SIDs and the originated domain or server is not online,
you can provide a file containing the needed SIDs (see /offlinesam).
You can dump the local cache of SIDs in a file (see /dumpcachedsids).


VIEW_MODE
---------

/noverbose /verbose

SubInAcl can be used in a quiet mode (/noverbose) or a in verbose mode
(/verbose , /Noverbose )
You can specify these switches either :
  - for the entire comand line :
       SubInAcl /noverbose /file *.dat /display
  - after a specific action    :
        SubInacl /file *.dat /display /noverbose /display

 

TEST_MODE
---------

/testmode /notestmode (default)

If /testmode is specified, the changes will not be reflected to the object
security descriptor. This option is useful to test the validity of a comand.
Ex : SubInacl /subdirec \\server\share\*.* /changedomain=DOMA=DOMB
              /ifchangecontinue /noverbose /display /testmode
     For each file modified this comand displays the modified security
     descriptor. But these changes will not physically apply to the files

 

OBJECT_TYPE
-----------

/file /subdirectories /onlyfile /keyreg /subkeyreg /service /share /clustershare /printer
/kernelobject /metabase /process /samobject

SubInAcl can work with various objects:
 - Files         :
      /file
      /subdirectories
      /onlyfile
 - Registry keys :
      /keyreg
      /subkeyreg
 - Services      :
      /service
 - Shares        :
      /share
      /clustershare
 - Printer       :
      /printer
 - Kernel named objects :
      /kernelobject
 - IIS adminidstration rights :
      /metabase
// - Process       :
      /process
 - Sam       :
      /SamObject

The actions are valid for all objects
Most of them support the enumeration with the * character


DOMAIN_MIGRATION
----------------

explain how to migrate security between domain SIDs

The main purpose of SubInAcl is to help administrators to migrate user(s)
if the domain architecture has changed.
For instance, the user John has moved and is now member of the DOMB domain.
You can reflect this change with :
SubInAcl /subdirec \\server\share\*.* /replace=OldDomain\John=DOMB\John
N.B: A trust relationship must be enabled between the domain of server and
OldDomain and NEWDOMAIN
N.B: If a trust relationship cannot be enabled, you can use the
/alternatesamserver=Server. Server should be the name of Domain Controller
Server

Sample :
  You have worked with a unique domain.
  You want to migrate a BDC named MIGRCONTROL with all the files and the
  users utilized on a new domain
  1. Reinstall the BDC as PDC to the NEWDOMAIN (without erasing the files)
  2. Create the users on NEWDOMAIN
  3. Create a "trusted relationship" with OLDDOMAIN
  4. Run SubInAcl /noverbose /subdirectories x:\*.*
                             /changedomain=OLDDOMAIN=NEWDOMAIN
  5. Verify the changes with SubInAcl /noverbose /subdirectories x:\*.*

Sample :
  You have worked with a standalone server named SERVER in a workgroup
  environment. You want to move this server (including users) to a domain DOM.
  1. Move SERVER to the domain DOM
  2. Create the users in the DOM domain
  3. SubInAcl /noverbose /subdirectories \\server\share
              /changedomain=SERVER=DOM

 See /changedomain /migratedomain /replace actions


SERVER_MIGRATION
----------------

explain how to migrate SIDs when objects are moved from one server to another one

Migrating file system from one local server to another local server is not
a trivial task. SubInAcl Version 2.2 has been enhanced to help this migration
process.
To migrate file system files from one local server and to preserve security,
you can perform the following steps:
 1. use scopy to copy files and ACLs on destination server
 2. create local groups on the destination server
 3. Use /changedomain or /changedomain with the /alternatesamserver option :
    By default SubInAcl queries the server where the objects are located to
    retrieve SIDS. This server is not aware of the SIDs valid on another
    standalone server
    To address this issue, you can use the /alternatesamserver option to ask
    SubInAcl to to use the alternamesamserver server if a SID resolution is
    not successfull on the initial server.
Sample :
    SubInAcl /alternatesamserver=SourceServer /subdirect
    \\DestServer\Share\*.*
             /migratedomain=SourceServer=DestServer

 See /alternatesamserver /migratedomain /offlinesam


EDITING_FEATURES
----------------

how to edit parts of the security descriptor

SubInAcl allows to modify each part of a a security descriptor :
- owner
       see /owner=SID or /setowner=SID
- primary group
       see /setprimarygroup=GroupSID
- system ACL (SubInAcl name = Audit ACL) with Access Control Entries
   (SubInAcl name= AAce = Audit ACE)
        see /audit /sgrant /sdeny /sallowdeny
- discretionnary ACL (SubInAcl name = Perm ACL ) with Access Control Entries
   (SubInAcl name= PAce = Perm ACE)
  see /perm   /pace=xxx  /revoke=SID /grant=SID=Access /deny=SID=access
       /sgrant=SID=Access /sdeny=SID=access
 /sallowdeny=SID=access- or the full security descriptor
  see /sddl=sddl_string

 

/SERVICE
--------

/service service_name

manipulate service
- \\ServerName\Messenger
- \\ServerName\M*
- Messenger
N.B: /driver can be used also.
      /driver  * will display all driversm
      /service * will display all services


/KEYREG
-------

/keyreg registry_key

manipulate registry keys
- HKEY_CURRENT_USER\Software
- HKEY_CURRENT_USER\Software\*Version
- \\Srv\HKEY_LOCAL_MACHINE\KeyPath


/SUBKEYREG
----------

/subkeyreg registry_key

manipulate registry keys and subkeys
- HKEY_CURRENT_USER\Software
- HKEY_CURRENT_USER\Software\*Version
- \\Srv\HKEY_LOCAL_MACHINE\KeyPath


/FILE
-----

/file filename

manipulate files
N.B: SubInAcl is not supported on DFS volumes
- *.obj
- c:\temp\*.obj
- \\servername\share\*.exe
- c:\
 /file=directoriesonly will apply parameters on directories only
 /file=filesonly will apply parameters on files only


/SUBDIRECTORIES
---------------

/subdirectories file_path

manipulate files in specified directory and all subdirectories
- c:\temp\*.obj     : work with all obj files
- c:\temp\test      : work with all test files below the c:\temp directory
- c:\temp\test\*.* : work with all files below temp\test
- c:\temp\test\    : work with all files below temp\test
 /subdirectories=directoriesonly will apply parameters on directories only
 /subdirectories=filesonly will apply parameters on files only


/ONLYFILE
---------

/onlyfile file_name

open a file without using the FindFilexxx mechanism.
Can be used to access named pipes or mailslot
- \\.\pipe\pipename


/SAMOBJECT
----------

/samobject samobject

allow to access ACL associated to SAM objects(users,localgroup,globalgroup).
Can be used to allow a localgroup(alias) created by a power users on a member
to be updated by another power users member
- \\samserver\localgroup
- \\samserver\*users*
- *group*
- Subinacl /samobject \\sams\testgroup /grant=poweruser1=f


/SHARE
------

/share file_share_name

access a network file share.
- \\server\share
- \\server\test*


/CLUSTERSHARE
-------------

/clustershare \\clustername\fileshareresource

access a cluster file share resource.
- \\clustername\FileShare_Resource_Name
- \\clustername\s*


/KERNELOBJECT
-------------

/kernelobject kernel_object_name

access a named kernel object.
Can be used to view mutex, sections, events objects


/PROCESS
--------

/process pid_or_executable_pattern

access a process object.
- notepad.* or pid_in_decimal


/METABASE
----------

/metabase metabase_path

access to IIS metabase AdminACL metabase property
Note that this property can only be used with these Metabase paths
/LM/MSFTPSVC , /LM/MSFTPSVC/n , /LM/W3SVC , /LM/W3SVC/
This object doesn't support enumeration.
 - SubInAcl /metabase \\ServerName\LM\W3SVC /grant=administrator=F

 

/PRINTER
---------

/printer printername

access to printer
- \\server\printer1
- \\server\*

 

/DISPLAY
--------

/display[=dacl|sacl|owner|primarygroup|sdsize|sddl]

display the security descriptor
You can also view part of the security descriptor. /display=dacl will
display the discretionary acl. /display=sddl will display the security
using the Win32 SDDL security descriptor string format (see Platform SDK)
The /noverbose display can be used to reapply the security descriptor
(see /playfile)


/PLAYFILE
---------

/playfile playfile

The /playfile feature allows SubInacl to run in a batch mode.
The format of the playfile command file is :
   + object_type object_name
   /action[=parameter]...
   /action[=parameter]...
   +object_type object_name
   /action[=parameter]...

 SubInacl /playfile=playfile.txt with
 With playfile :
+subdirec *.txt
/grant=everyone=R
+service RkillSrv
/display
will give the same result than
SubInAcl /subdirectories *.txt  /grant=everyone=R
SubInAcl /service RkillSrv /display

One typical usage of the playfile feature is to allow to reapply security settings
saved previously because the output format of the noverbose /display is a playfile
compatible format:
1.a)    SubInAcl  /noverbose /outputlog=d:\SubInaclSave.txt /subdirectories c:\*.* /display
This command saves all security settings for the files on C: drive.
Sids will be saved in the Domain\user string format
The /display option in a noverbose mode uses an output playfile compatible format
or
1.b)  SubInAcl /error=d:\Err.txt /outputlog=d:\SubInaclSave.txt /subdirectories c:\*.* /display=sddl
This command saves all security settings using the Win32 SDDL format.
Sids will be saved in the S-1-x-x form. This will not require SubInacl to translate Sids
This may minimize the elapsed time and resource usage
2)      SubInAcl /playfile d:\SubInaclSave.txt
This command will reapply the previously saved settings.

One other advantage of using a playfile is to improve performance and save network
bandwidth because SubInacl maintains a local cache of SIDs.
For instance if you issue :
SubInacl /subdirectories c:\*.* /migrate=domain1=domain2
And
SubInacl /subdirectories d:\*.* /migrate=domain1=domain2

Batching  these commands will reduce the network usage bandwidth and improve
performance because SID TO HUMAN NAME resolution process will be reduced.


/OUTPUTLOG
----------

/outputlog=filename

all outputs will be send in filename. You need to use /errlog switch to
redirect all errors in a different file


/ERRORLOG
---------

/errorlog=filename.txt

all errors will be send in the filename.txt


/ALTERNATESAMSERVER
-------------------

/alternatesamserver=Server

SubInAcl queries the Server where the object is located to lookup Sids.
Under some circumstances , you may need ( see server_migration or
domain_migration) to retrieve Sids from another server. If a Sid resolution is
unsuccessful, this option allows SubInAcl to query the alternamesamserver.


/OFFLINESAM
-----------

/offlinesam=FileName

By default, SubInAcl queries the Server where the object is located to lookup
Sids.Under some circumstances (migration where the source server is offline
or if a domain is no longer available, want to avoid network round trip
for SIDs retrievals), you may allow SubInAcl.exe to retrieve SIDs from
the FileName file.
File format is :
__cachefileonly__=s-1-9-cacheonly
domain\simon=S-1-5-21-1190502449-1716722630-1654032285-1105
nat\julien=S-1-5-21-1060284298-436374069-1708537768-1005

where domain\simon and nat\julien can be a domain account or server account.
With the __cachefileonly__ line in the file, SubInAcl.exe will not query
SAM Server(s) anymore. All needed SIDs should be found in the SAM
cache file


/DUMPCACHEDSIDS
---------------

/dumpcachedsids=FileName

At the end of the subinacl execution,
you can dump the contents of the local cache Sids in a file.
This file can later be used for future SubInacl execution (see .
/offlinesam) to speed up the Sids resolution process)


/SETOWNER
---------

/setowner=SID

will change the owner of the object
/owner=SID or /setowner=SID
owner = DomainName\Administrators will retrieve the Administrators Sid on
the server where the object is (see Win32 SDK LookupAccountName function).


/REPLACE
--------

/replace=DomainName\OldAccount=DomainName\New_Account

    replace all ACEs (Audit and Permissions) in the object
    Ex: /replace=DOM_MARKETING\ChairMan=NEWDOM\NewChairMan will replace
        all ACEs containing DOM_MARKETING\ChairMan with NewChairMan SID
        retrieves from NEWDOM domain
    Warning: if DomainName\New_Account has already an ACE, ACE replacement is
    skipped


/ACCOUNTMIGRATION
-----------------

/accountmigration=DomainName\OldAccount=DomainName\New_Account

    (see /replace)
    will :
    - replace owner or primary group if one of them is DomainName\OldAccount.
    - duplicate ACE(s) with reference to DomainName\OldAccount for New_Account
    Ex: /accountmigration=DOM_MARKETING\ChairMan=NEWDOM\NewChairMan will
    duplicate all ACEs containing DOM_MARKETING\ChairMan with NewChairMan SID
    retrieves from NEWDOM domain
    Warning : if DomainName\New_Account has already an ACE, ACE replacement is
    skipped


/CLEANDELETEDSIDSFROM
---------------------

/cleandeletedsidsfrom=domain[=dacl|sacl|owner|primarygroup|all]

    delete all ACEs containing deleted (no valid) Sids from DomainName
    You can specify which part of the security descriptor will be scanned
    (default=all)
    If the owner is deleted, new owner will be the Administrators group.
    If the primary group is deleted, new primary group will be the Users group.


/CHANGEDOMAIN
-------------

/changedomain=OldDomainName=NewDomainName[=MappingFile[=Both]]

     replace all ACEs with a Sid from OldDomainName
     with the equivalent Sid found in NewSamServer
     Ex: /changedomain=DOM_MARKETING=NEWDOMAIN
     replace all ACEs containing DOM_MARKETING\ChairMan SID
     with the ChairMan's SID retrieved on NEWDOMAIN computer
     The NEWDOMAIN must have a trusted relationship with the server
     containing the object

     If you want to explicitly specify the users affected , you can specify a
     mapping file. The MappingFile file will allow you to specify the list of
     users affected and the name of the replacing user in the NewDomain

     Below a sample of a MappingFile

     simon=julien
     administrator=administrator

     OldDomainName\Simon will be replaced by NewDomainName\Julien and
     OldDomainName\Administrator will be replaced with
     NewDomainName\Administrator

     If you use /changedomain=OldDomainName=NewDomainName=MappingFile notation
     ,only users defined in this file will be migrated.
     If you use /changedomain=OldDomainName=NewDomainName=MappingFile=Both,
     the mapping file will be examined first to determine if a mapping user
     exist. If not, SubInacl will try to find the equivalent user in the
     NewDomainName


/MIGRATETODOMAIN
----------------

/migratetodomain=FromDomainName=ToDomainName[=MappingFile[=Both]]

     same behavior than /changedomain except that news ACEs will added instead
     of replacing
     Ex: /migratetodomain=DOM1=DOM2
     each ace with DOM1\User will be duplicated with DOM2\User
     (If DOM2\User exists)
     If during the migration there was a serious oversight
     you can instruct the user to log back onto DOM1.
     N.B: Owner and Primary Group are migrated to DOM2


/FINDSID
--------

/findsid=DomainName\Account[=stop|continue]

     display the object name containing a reference to DomainName\Account
     in the security descriptor
     stop     - if Account is found, next parameters will be skipped
                and changes will not be applied
              - if Account is not found, next parameter will be executed
     continue - if Account found, next parameters will be executed
              - if Account not found, next parameters will be skipped
                and changes will not be applied


/SUPPRESSSID
------------

/suppresssid=DomainName\Account

     suppress all ACES containing the DomainName\Account SID.
     If the object's owner is DomainName\Account, the owner is set to
     Everyone's SID.


/PERM
-----

/perm

     suppress all existing permissions aces (PACEs)


/AUDIT
------

/audit

     suppress all existing auditing aces (AACEs)


/IFCHANGECONTINUE
-----------------

/ifchangecontinue

     continue to process the next actions only if some changes have been
     made in the previous actions


/TESTMODE
---------

/testmode

     changes will not be applied to the object. This allows to test the
     modifications


/ACCESSCHECK
------------

/accesscheck=Domain\Username

     display the access granted to the Domain\Username. The password will
     be asked. This option requires the SeTcbName privilege (Act as Part
     of the Operating System). This option cannot be used with remote object.
     Note : the access is checked with the NETWORK security identified
     granted to the Domain\UserName


/SETPRIMARYGROUP
----------------

/setprimarygroup=[DomainName\]Group

     change the primary group


/DENY
-----

/deny=[DomainName\]User[=Access]

     add a  denied Permission Ace for the specified User (or group)
          If Access is not specified, all accesses will be denied.

     File:
       F : Full Control
       C : Change
       R : Read
       P : Change Permissions
       O : Take Ownership
       X : eXecute
       E : Read eXecute
       W : Write
       D : Delete

     ClusterShare:
       F : Full Control
       R : Read
       C : Change

     Printer:
       F : Full Control
       M : Manage Documents
       P : Print

     KeyReg:
       F : Full Control
       R : Read
       A : ReAd Control
       Q : Query Value
       S : Set Value
       C : Create SubKey
       E : Enumerate Subkeys
       Y : NotifY
       L : Create Link
       D : Delete
       W : Write DAC
       O : Write Owner

     Service:
       F : Full Control
       R : Generic Read
       W : Generic Write
       X : Generic eXecute
       L : Read controL
       Q : Query Service Configuration
       S : Query Service Status
       E : Enumerate Dependent Services
       C : Service Change Configuration
       T : Start Service
       O : Stop Service
       P : Pause/Continue Service
       I : Interrogate Service
       U : Service User-Defined Control Commands

     Share:
       F : Full Control
       R : Read
       C : Change

     Metabase:
       F : Full Control
       R : Read - MD_ACR_READ
       W : Write - MD_ACR_WRITE
       I : Restricted Write - MD_ACR_RESTRICTED_WRITE
       U : Unsecure props read - MD_ACR_UNSECURE_PROPS_READ
       E : Enum keys- MD_ACR_ENUM_KEYS
       D : write Dac- MD_ACR_WRITE_DAC

     Process:
       F : Full Control
       R : Read
       W : Write
       X : eXecute

     SamObject:
       F : Full Control
       W : Write
       R : Read
       X : Execute


/REVOKE
-------

/revoke=[DomainName\]User

     suppress all Permission Ace(s) for the specified User (or group)


/GRANT
------

/grant=[DomainName\]User[=Access]

     will add a Permission Ace for the user.
     if Access is not specified, the Full Control access will be granted.

     File:
       F : Full Control
       C : Change
       R : Read
       P : Change Permissions
       O : Take Ownership
       X : eXecute
       E : Read eXecute
       W : Write
       D : Delete

     ClusterShare:
       F : Full Control
       R : Read
       C : Change

     Printer:
       F : Full Control
       M : Manage Documents
       P : Print

     KeyReg:
       F : Full Control
       R : Read
       A : ReAd Control
       Q : Query Value
       S : Set Value
       C : Create SubKey
       E : Enumerate Subkeys
       Y : NotifY
       L : Create Link
       D : Delete
       W : Write DAC
       O : Write Owner

     Service:
       F : Full Control
       R : Generic Read
       W : Generic Write
       X : Generic eXecute
       L : Read controL
       Q : Query Service Configuration
       S : Query Service Status
       E : Enumerate Dependent Services
       C : Service Change Configuration
       T : Start Service
       O : Stop Service
       P : Pause/Continue Service
       I : Interrogate Service
       U : Service User-Defined Control Commands

     Share:
       F : Full Control
       R : Read
       C : Change

     Metabase:
       F : Full Control
       R : Read - MD_ACR_READ
       W : Write - MD_ACR_WRITE
       I : Restricted Write - MD_ACR_RESTRICTED_WRITE
       U : Unsecure props read - MD_ACR_UNSECURE_PROPS_READ
       E : Enum keys- MD_ACR_ENUM_KEYS
       D : write Dac- MD_ACR_WRITE_DAC

     Process:
       F : Full Control
       R : Read
       W : Write
       X : eXecute

     SamObject:
       F : Full Control
       W : Write
       R : Read
       X : Execute


/SALLOWDENY
-----------

/sallowdeny=[DomainName\]User[=Access]

     will add an Allow/Failed Audit Ace for the user and remove all existing
     Audit Ace for this user(or group).
     if Access is not specified, the Full Control access mask will be used.
     Ex: SubInacl /file c:\windows\explorer.exe /sallowdeny=everyone=R
         will set the audit for everyone's successful and failed access


/SGRANT
-------

/sgrant=[DomainName\]User[=Access]

     will add a Successfull (Allow) Audit Ace for the user and remove all existing
     Audit Ace for this user(or group).
     if Access is not specified, the Full Control access mask will be used.
     Ex: SubInacl /file c:\windows\explorer.exe /sgrant=everyone=R
         will set the audit for everyone's successful access

     File:
       F : Full Control
       C : Change
       R : Read
       P : Change Permissions
       O : Take Ownership
       X : eXecute
       E : Read eXecute
       W : Write
       D : Delete

     ClusterShare:
       F : Full Control
       R : Read
       C : Change

     Printer:
       F : Full Control
       M : Manage Documents
       P : Print

     KeyReg:
       F : Full Control
       R : Read
       A : ReAd Control
       Q : Query Value
       S : Set Value
       C : Create SubKey
       E : Enumerate Subkeys
       Y : NotifY
       L : Create Link
       D : Delete
       W : Write DAC
       O : Write Owner

     Service:
       F : Full Control
       R : Generic Read
       W : Generic Write
       X : Generic eXecute
       L : Read controL
       Q : Query Service Configuration
       S : Query Service Status
       E : Enumerate Dependent Services
       C : Service Change Configuration
       T : Start Service
       O : Stop Service
       P : Pause/Continue Service
       I : Interrogate Service
       U : Service User-Defined Control Commands

     Share:
       F : Full Control
       R : Read
       C : Change

     Metabase:
       F : Full Control
       R : Read - MD_ACR_READ
       W : Write - MD_ACR_WRITE
       I : Restricted Write - MD_ACR_RESTRICTED_WRITE
       U : Unsecure props read - MD_ACR_UNSECURE_PROPS_READ
       E : Enum keys- MD_ACR_ENUM_KEYS
       D : write Dac- MD_ACR_WRITE_DAC

     Process:
       F : Full Control
       R : Read
       W : Write
       X : eXecute

     SamObject:
       F : Full Control
       W : Write
       R : Read
       X : Execute


/SDENY
------

/sdeny=[DomainName\]User[=Access]

     will add a Failed Audit Ace for the user and remove all existing
     Audit Ace for this user(or group).
     if Access is not specified, the Full Control access mask will be used.

     File:
       F : Full Control
       C : Change
       R : Read
       P : Change Permissions
       O : Take Ownership
       X : eXecute
       E : Read eXecute
       W : Write
       D : Delete

     ClusterShare:
       F : Full Control
       R : Read
       C : Change

     Printer:
       F : Full Control
       M : Manage Documents
       P : Print

     KeyReg:
       F : Full Control
       R : Read
       A : ReAd Control
       Q : Query Value
       S : Set Value
       C : Create SubKey
       E : Enumerate Subkeys
       Y : NotifY
       L : Create Link
       D : Delete
       W : Write DAC
       O : Write Owner

     Service:
       F : Full Control
       R : Generic Read
       W : Generic Write
       X : Generic eXecute
-- Press Return To Continue ----
       L : Read controL
       Q : Query Service Configuration
       S : Query Service Status
       E : Enumerate Dependent Services
       C : Service Change Configuration
       T : Start Service
       O : Stop Service
       P : Pause/Continue Service
       I : Interrogate Service
       U : Service User-Defined Control Commands

     Share:
       F : Full Control
       R : Read
       C : Change

     Metabase:
       F : Full Control
       R : Read - MD_ACR_READ
       W : Write - MD_ACR_WRITE
       I : Restricted Write - MD_ACR_RESTRICTED_WRITE
       U : Unsecure props read - MD_ACR_UNSECURE_PROPS_READ
       E : Enum keys- MD_ACR_ENUM_KEYS
       D : write Dac- MD_ACR_WRITE_DAC

     Process:
       F : Full Control
       R : Read
       W : Write
       X : eXecute

     SamObject:
       F : Full Control
       W : Write
       R : Read
       X : Execute


/OBJECTEXCLUDE
--------------

/objectexclude=pattern

      all objects matching the pattern string will be skipped (eXcluded).
           The only wildcard valid is *. It can be used everywhere in the string.
      Pattern may be a name ( *Name.exe ) or a path ( *dir\subdir\*ToExclude* ).


/PATHEXCLUDE
------------

/pathexclude=pattern

      all containers matching the pattern string will not be enumerated.
      See /objectexclude
      N.B: the Actions specified will not be applied to the container too.


/STATISTIC
----------

/statistic

      will display statistics when processing is finished.


/CROSSREPARSEPOINT
------------------

/crossreparsepoint

      When processing a file system path, SubInacl will enumerate
      file and directories below a reparsepoint except if /nocrossreparsepoint.
      is specified.


/STRINGREPLACEONOUTPUT
----------------------

/stringreplaceonoutput=string1=string2

      All occurrences of string1 will be replaced by string2 in subinacl output.


/SDDL
-----

/sddl=sddl_string

      specify the Security descriptor for the object using the Win32 security
      descriptor definition language (SDDL)


/APPLYONLY
----------

/applyonly=dacl,sacl,owner,group

      Some subinacl options may change parts (owner,group,dacl,sacl) of the security descriptor.
      You may restrict the change to some parts of the security descriptor only .
      For instance /applyonly=dacl,sacl,owner will not modify the primary group field


/PATHCOPYSECURITY
-----------------

/pathcopysecurity=path_container

      SubInacl will reset the security descriptor for the object with the same named object
      in the container path.
      Ex: - SubInacl /file c:\temp\*.txt /pathcopysecurity=d:\test
          will replace the security (acls,owner,primarygroup) for c:\temp\1.txt with the security
          retrieved from d:\test\1.txt (if this file exists)
          -SubInacl /service Messenger /pathcopysecurity=\\Server
          will update the security on the service Messenger with the security existing on the remote
          messenger service


/OBJECTCOPYSECURITY
-------------------

/objectcopysecurity=object_path

      SubInacl will reset the security descriptor with the object object_path
      in the container path.
      Ex: - SubInacl /file c:\temp\*.txt /objectcopysecurity=d:\test\mask.txt
          will replace the security (acls,owner,primarygroup) for all txt files
          in c: emp with the security retrieved on d:\test\amsk.txt
          will update the security on the service Messenger with the security existing on the remote
          messenger service


C:\Users\Administrator\Downloads\subinacl>subinacl /help
SubInAcl version 5.2.3790.1180

USAGE
-----

Usage :
     SubInAcl [/option...] /object_type object_name [[/action[=parameter]...]

 

 /options    :
    /outputlog=FileName                 /errorlog=FileName
    /noverbose                          /verbose (default)
    /notestmode (default)               /testmode
    /alternatesamserver=SamServer       /offlinesam=FileName
    /stringreplaceonoutput=string1=string2
    /expandenvironmentsymbols (default) /noexpandenvironmentsymbols
    /statistic (default)                /nostatistic
    /dumpcachedsids=FileName            /separator=character
    /applyonly=[dacl,sacl,owner,group]
    /nocrossreparsepoint (default)      /crossreparsepoint

 /object_type :
    /service            /keyreg             /subkeyreg
    /file               /subdirectories[=directoriesonly|filesonly]
    /clustershare       /kernelobject       /metabase
    /printer            /onlyfile           /process
    /share              /samobject

 /action      :
    /display[=dacl|sacl|owner|primarygroup|sdsize|sddl] (default)
    /setowner=owner
    /replace=[DomainName\]OldAccount=[DomainName\]New_Account
    /accountmigration=[DomainName\]OldAccount=[DomainName\]New_Account
    /changedomain=OldDomainName=NewDomainName[=MappingFile[=Both]]
    /migratetodomain=SourceDomain=DestDomain=[MappingFile[=Both]]
    /findsid=[DomainName\]Account[=stop|continue]
    /suppresssid=[DomainName\]Account
    /confirm
    /ifchangecontinue
    /cleandeletedsidsfrom=DomainName[=dacl|sacl|owner|primarygroup|all]
    /testmode
    /accesscheck=[DomainName\]Username
    /setprimarygroup=[DomainName\]Group
    /grant=[DomainName\]Username[=Access]
    /deny=[DomainName\]Username[=Access]
    /sgrant=[DomainName\]Username[=Access]
    /sdeny=[DomainName\]Username[=Access]
    /sallowdeny==[DomainName\]Username[=Access]
    /revoke=[DomainName\]Username
    /perm
    /audit
    /compactsecuritydescriptor
    /pathexclude=pattern
    /objectexclude=pattern
    /sddl=sddl_string
    /objectcopysecurity=object_path
    /pathcopysecurity=path_container

Usage  : SubInAcl   [/option...] /playfile file_name

Usage  : SubInAcl   /help [keyword]
         SubInAcl   /help /full
    keyword can be :
    features  usage syntax sids  view_mode test_mode object_type
    domain_migration server_migration substitution_features editing_features
         - or -
    any [/option] [/action] [/object_type]


C:\Users\Administrator>icacls /?

ICACLS name /save aclfile [/T] [/C] [/L] [/Q]     将匹配名称的文件和文件夹的 DACL 存储到 aclfile 中以便将来与 /restore 一起使用。请注意,未保存 SACL、所有者或完整性标签。

ICACLS directory [/substitute SidOld SidNew [...]] /restore aclfile[/C] [/L] [/Q]    将存储的 DACL 应用于目录中的文件。

ICACLS name /setowner user [/T] [/C] [/L] [/Q]   更改所有匹配名称的所有者。该选项不会强制更改所有身份;使用 takeown.exe 实用程序可实现该目的。

ICACLS name /findsid Sid [/T] [/C] [/L] [/Q]  查找包含显式提及 SID 的 ACL 的所有匹配名称。

ICACLS name /verify [/T] [/C] [/L] [/Q]   查找其 ACL 不规范或长度与 ACE计数不一致的所有文件。

ICACLS name /reset [/T] [/C] [/L] [/Q]   为所有匹配文件使用默认继承的 ACL 替换 ACL。

ICACLS name [/grant[:r] Sid:perm[...]][/deny Sid:perm [...]][/remove[:g|:d]] Sid[...]] [/T] [/C] [/L] [/Q] [/setintegritylevel Level:policy[...]]

   ICACLS  /grant[:r] Sid:perm 授予指定的用户访问权限。如果使用 :r,这些权限将替换以前授予的所有显式权限。如果不使用 :r,这些权限将添加到以前授予的所有显式权限。

  ICACLS   /deny Sid:perm 显式拒绝指定的用户访问权限。将为列出的权限添加显式拒绝 ACE,并删除所有显式授予的权限中的相同权限。

   ICACLS  /remove[:[g|d]] Sid 删除 ACL 中所有出现的 SID。使用 :g,将删除授予该 SID 的所有权限。使用  :d,将删除拒绝该 SID 的所有权限。

   ICACLS  /setintegritylevel [(CI)(OI)]级别将完整性 ACE 显式添加到所有匹配文件。要指定的级别为以下级别之一:
             L[ow]
             M[edium]
             H[igh]
        完整性 ACE 的继承选项可以优先于级别,但只应用于目录。

   ICACLS  /inheritance:e|d|r
        e - 启用继承
        d - 禁用继承并复制 ACE
        r - 删除所有继承的 ACE


注意:
    Sid 可以采用数字格式或友好的名称格式。如果给定数字格式,那么请在 SID 的开头添加一个 *。

   ICACLS  /T 指示在以该名称指定的目录下的所有匹配文件/目录上执行此操作。

   ICACLS  /C 指示此操作将在所有文件错误上继续进行。仍将显示错误消息。

   ICACLS  /L 指示此操作在符号链接本身而不是其目标上执行。

    ICACLS  /Q 指示 icacls 应该禁止显示成功消息。

    ICACLS 保留 ACE 项的规范顺序:
            显式拒绝
            显式授予
            继承的拒绝
            继承的授予

    perm 是权限掩码,可以指定两种格式之一:简单权限序列:
                N - 无访问权限
                F - 完全访问权限
                M - 修改权限
                RX - 读取和执行权限
                R - 只读权限
                W - 只写权限
                D - 删除权限
        在括号中以逗号分隔的特定权限列表:
                DE - 删除
                RC - 读取控制
                WDAC - 写入 DAC
                WO - 写入所有者
                S - 同步
                AS - 访问系统安全性
                MA - 允许的最大值
                GR - 一般性读取
                GW - 一般性写入
                GE - 一般性执行
                GA - 全为一般性
                RD - 读取数据/列出目录
                WD - 写入数据/添加文件
                AD - 附加数据/添加子目录
                REA - 读取扩展属性
                WEA - 写入扩展属性
                X - 执行/遍历
                DC - 删除子项
                RA - 读取属性
                WA - 写入属性
        继承权限可以优先于每种格式,但只应用于目录:
                (OI) - 对象继承
                (CI) - 容器继承
                (IO) - 仅继承
                (NP) - 不传播继承
                (I) - 从父容器继承的权限

示例:

        icacls c:\windows\* /save AclFile /T    - 将 c:\windows 及其子目录下所有文件的ACL 保存到 AclFile。

        icacls c:\windows\ /restore AclFile - 将还原 c:\windows 及其子目录下存在的 AclFile 内所有文件的 ACL。

        icacls file /grant Administrator:(D,WDAC) - 将授予用户对文件删除和写入 DAC 的管理员权限。

        icacls file /grant *S-1-1-0:(D,WDAC) - 将授予由 sid S-1-1-0 定义的用户对文件删除和写入 DAC 的权限。


Secedit 是 Windows 系统自带的一个命令行工具,用于管理和分析安全策略与安全模板。它主要用于安全配置的应用、分析和导出等操作。

命令的基本格式是:

 
secedit [/configure | /analyze | /import | /export | /validate | /generaterollback] [/option]

各参数功能简要说明:

  1. /configure

    • 应用安全模板到本地计算机。
    • 示例:
       
      secedit /configure /db secedit.sdb /cfg C:\Windows\security\templates\hisecws.inf /overwrite
  2. /analyze

    • 分析当前系统安全配置与指定安全模板的差异,并生成报告。
    • 示例:
       
      secedit /analyze /db secedit.sdb /cfg C:\Windows\security\templates\hisecws.inf /log log.txt /verbose
  3. /import

    • 导入安全模板到数据库,但不应用。
    • 示例:
       
      secedit /import /db secedit.sdb /cfg C:\template.inf
  4. /export

    • 将安全数据库导出为安全模板文件。
    • 示例:
       
      secedit /export /db secedit.sdb /cfg C:\export.inf
  5. /validate

    • 验证安全模板的语法是否正确。
    • 示例:
       
      secedit /validate /cfg C:\template.inf
  6. /generaterollback

    • 生成回滚文件,以便在应用安全模板后可以恢复原来的设置。
    • 示例:
       
      secedit /generaterollback /db secedit.sdb /cfg C:\template.inf /rollbackfile C:\rollback.inf

Secedit /?

此命令的语法为:

secedit [/configure | /analyze | /import | /export | /validate | /generaterollback]

C:\Users\Administrator>secedit /configure

允许你用保存在数据库中的安全性设置来配置系统。

此命令的语法为:

secedit /configure /db filename [/cfg filename] [/overwrite][/areas area1 area2...] [/log filename] [/quiet]

            /db filename - 指定用来执行安全性配置的数据库。

            /cfg filename - 指定在配置次计算机前要导入到数据库的安全性模板。安全性模板是用安全性模板管理单元创建的。

            /overwrite - 指定在导入安全性模板前数据库应该被清空。如果没有指定此参数,在安全性模板中指定的将累积到数据库中。如果没有指定此参数而且在数据库中的设置与要导入的模板冲突,将采用模板中的设置。

            /areas - 指定要应用到系统的安全性范围。如果没有指定此参数,在数据库中定义的所有安全性设置都将应用到系统中。要配置多个范围,用空格将它们分开。下列安全性范围将被导出:

                        SECURITYPOLICY - 包括帐户策略,审核策略,事件日志设置和安全选项。
                        GROUP_MGMT - 包括受限制的组设置
                        USER_RIGHTS - 包括用户权限分配
                        REGKEYS - 包括注册表权限
                        FILESTORE - 包括文件系统权限
                        SERVICES - 包括系统服务设置

            /log filename - 指定要记录配置操作状态的文件。如果没有指定,配置操作信息将被记录到 scesrv.log 文件中,此文件为于 %windir%\security\logs 目录。

            /quiet - 指定配置操作的执行不需要提示用户进行任何确认。

示例:

secedit /configure /db hisecws.sdb /cfg hisecws.inf /overwrite /log hisecws.log

对于所有的文件名,如果没有指定路径,则是用当前目录。

C:\Users\Administrator>secedit /analyze

允许你基于存储在数据库中的基线设置来分析当前系统设置。此分析结果将保存在数据库中的一个独立的位置,并且可以用安全配置和分析管理单元来查看。

此命令的语法为:

secedit /analyze /db filename [/cfg filename ] [/overwrite] [/log filename] [/quiet]

            /db filename - 指定用来执行分析的数据库。

            /cfg filename - 指定在进行分析前要导入到数据库的安全模板。安全模板是用安全模板管理单元创建的。

            /log filename - 指定要记录配置处理状态的文件。如果没有指定,配置处理信息将被记录在 scesrv.log 文件中,可以在 s%windir%\security\logs 目录中找到它。

            /quiet - 指定分析处理的执行不需要提示用户进行任何确认。

示例:

secedit /analyze /db hisecws.sdb

对于所有文件名,如果没有指定路径,则使用当前目录。

C:\Users\Administrator>secedit  /import

允许你导入安全模板到数据库,这样在模板中指定的设置就可以应用到系统或对系统进行分析。

此命令的语法为:

secedit /import  /db filename /cfg filename [/overwrite][/areas area1 area2...] [/log filename] [/quiet]

            /db filename - 指定将要导入安全模板设置的数据库。

            /cfg filename - 指定要导入到数据库的安全模板。安全模板是用安全模板管理单元创建的。

            /overwrite - 指定在导入安全模板之前数据库应该被清空。如果没有指定此参数,在安全模板中的设置将被附加到数据库中。如果没有指定此参数并且在要导入的模板和数据库之间有设置冲突,将采用模板中的设置。

            /areas - 指定要导出的安全范围。如果没有指定此参数,将导出在数据库中定义的所有安全设置。要导出特定范围,用空格分隔它们。下列安全范围将被导出:

                        SECURITYPOLICY - 包括帐户策略,审核策略,事件日志设置和安全选项。
                        GROUP_MGMT - 包括受限制的组设置
                        USER_RIGHTS - 包括用户权限分配
                        REGKEYS - 包括注册表权限
                        FILESTORE - 包括文件系统权限
                        SERVICES - 包括系统服务设置

            /log filename - 指定要记录倒入操作状态的文件。如果没有指定,配置操作信息将被记录到 scesrv.log file 中,此文件为于 %windir%\security\logs 目录。

            /quiet - 指定导入操作的执行不需要提示用户进行任何确认。

示例:

secedit /import /db hisecws.sdb /cfg hisecws.inf /overwrite

对于所有的文件名,如果没有指定路径,则是用当前目录。

C:\Users\Administrator>secedit /export

允许你导出保存在数据库中的安全设置。

此命令的语法为:

secedit /export [/db filename] [/mergedpolicy] /cfg filename [/areas area1 area2...] [/log filename]

            /db filename - 指定要导出数据的数据库。如果没有指定,将使用系统安全数据库。

            /cfg filename - 指定要导出数据库内容的安全模板。

            /mergedpolicy - 合并并且导出域和本地策略安全设置。

            /areas - 指定要应用到系统的安全性范围。如果没有指定此参数,在数据库中定义的所有安全性设置都将应用到系统中。要配置多个范围,用空格将它们分开。下列安全性范围是受支持的:

                        SECURITYPOLICY - 包括帐户策略,审核策略,事件日志设置和安全选项。
                        GROUP_MGMT - 包括受限制的组设置
                        USER_RIGHTS - 包括用户权限分配
                        REGKEYS - 包括注册表权限
                        FILESTORE - 包括文件系统权限
                        SERVICES - 包括系统服务设置

            /log filename - 指定要记录导出操作状态的文件。如果没有指定,配置操作信息将被记录到 scesrv.log file 中,此文件为于 %windir%\security\logs 目录。

示例:

secedit /export /db hisecws.sdb /cfg hisecws.inf /log hisecws.log

对于所有的文件名,如果没有指定路径,则是用当前目录。

C:\Users\Administrator>secedit /validate

允许你验证安全模板的语法。

此命令的语法为:

secedit /validate filename

            /cfg filename - 指定要验证的安全模板。安全模板是用安全模板管理单元创建的。

示例:

secedit /validate hisecws.inf

对于所有的文件名,如果没有指定路径,则是用当前目录。

C:\Users\Administrator>secedit  /generaterollback

允许你生成一个关于配置模板的复原模板。

此命令的语法为:

secedit /generaterollback /cfg filename /rbk filename [/log filename] [/quiet]

            /db filename - 指定执行复原操作使用的数据库。

            /cfg filename - 指定一个将要生成关于它的复原模板的安全模板。安全模板是用安全模板管理单元创建的。

            /rbk filename - 指定一个复原信息要写入的安全模板。安全模板是用安全模板管理单元创建的。

            /log filename - 指定记录复原操作状态的文件。如果没有指定,复原处理信息将被记录在 scesrv.log 文件中,可以在 s%windir%\security\logs 目录中找到它。

            /quiet - 指定复原处理的执行不需要提示用户进行任何确认。

示例:

secedit /generaterollback /db hisecws.sdb /cfg hisecws.inf /rbk hisecwsrollback.inf /log hisecws.log

对于所有的文件名,如果没有指定路径,则是用当前目录。


SubInAclicacls 和 PowerShell 的命令,它们在文件和文件夹权限管理方面也有一些区别。下面是这三者的对比表:

特性 SubInAcl icacls PowerShell
功能 用于更改文件夹和文件的权限、所有权等 用于查看和修改文件和文件夹的访问控制列表(ACL) 通过 cmdlet 对文件和文件夹权限进行操作
命令格式 SubInAcl /command icacls <filename> /<option> Get-Acl <path>Set-Acl <path>
操作系统支持 主要支持 Windows 7/8/10 和 Server 系列 支持 Windows Vista 及更新版本 支持所有 Windows 系统,PowerShell 3.0+
详细权限控制 支持权限继承、指定用户和组权限 支持权限继承、显示完整的权限列表 提供丰富的权限设置和访问控制选项
批量操作 支持批量操作文件夹/文件权限 支持批量操作,可以同时处理多个文件 支持通过脚本批量操作
易用性 比较复杂,适合用于脚本化处理 相对简单,适合用于快速查看和修改权限 灵活,但需要一定的 PowerShell 知识
日志输出 提供详细的操作日志 输出简单的操作结果和错误信息 输出详细的操作结果和错误信息
常见用途 更改多个文件的权限,设置文件所有者 修改文件权限、查看文件权限 更复杂的权限管理、文件操作和自动化
脚本支持 强大的批处理支持 简单批量操作 完全支持脚本和自动化

总结:

  • SubInAcl 适合进行复杂和批量的权限管理,尤其是在需要调整文件所有者的场景下。
  • icacls 更适合快速和简单的权限查看与修改。
  • PowerShell 则提供了更强大的灵活性,适合需要自动化、批量操作的高级用户,尤其是通过脚本处理复杂的权限管理任务。

SubInAclicacls 命令的等效对应关系对比表:

功能/操作 SubInAcl 命令 icacls 命令
查看文件或文件夹的权限 subinacl /file "C:\path\to\file" icacls "C:\path\to\file"
查看文件夹的继承权限 subinacl /subdirectories "C:\folder" icacls "C:\folder" /inheritance
设置文件或文件夹的所有者 subinacl /file "C:\path\to\file" /setowner=Administrator icacls "C:\path\to\file" /setowner "Administrator"
更改文件或文件夹的权限 subinacl /file "C:\path\to\file" /grant=User=F icacls "C:\path\to\file" /grant User:F
删除文件或文件夹的权限 subinacl /file "C:\path\to\file" /remove=User icacls "C:\path\to\file" /remove User
给用户授予权限 subinacl /file "C:\path\to\file" /grant=User=F icacls "C:\path\to\file" /grant User:F
撤销用户的权限 subinacl /file "C:\path\to\file" /revoke=User icacls "C:\path\to\file" /revoke User
备份文件夹权限 不直接支持此功能 icacls "C:\folder" /save "C:\backup_acl.txt"
恢复文件夹权限 不直接支持此功能 icacls "C:\folder" /restore "C:\backup_acl.txt"
删除所有文件夹权限 subinacl /file "C:\folder" /reset icacls "C:\folder" /reset
设置文件夹的权限继承 subinacl /subdirectories "C:\folder" /setinheritance=1 icacls "C:\folder" /inheritance:e
关闭文件夹权限继承 subinacl /subdirectories "C:\folder" /setinheritance=0 icacls "C:\folder" /inheritance:d
查看文件的所有者 subinacl /file "C:\path\to\file" /displayowner icacls "C:\path\to\file" /findsid
查看继承权限的详细信息 不支持直接的继承信息查看 icacls "C:\path\to\file" /inheritance
为文件设置“完全控制”权限 subinacl /file "C:\path\to\file" /grant=User=F icacls "C:\path\to\file" /grant User:F
设置文件权限为“只读” subinacl /file "C:\path\to\file" /grant=User=R icacls "C:\path\to\file" /grant User:R
删除文件的所有者 subinacl /file "C:\path\to\file" /removeowner icacls "C:\path\to\file" /removeowner

说明:

  • SubInAcl 在某些功能上如批量操作、文件权限继承的细节处理方面更为灵活,但功能上已经不再更新。
  • icacls 提供了更多现代化的功能,支持权限备份、恢复等,并且更适合 Windows 7 及之后的版本,且被微软官方推荐为标准工具。

在日常使用中,icacls 更为常见且操作简便,适合大部分文件夹和文件权限管理任务。

 


补充 SubInAclicacls 命令的等效对应关系,涵盖一些其他常见的操作:

功能/操作 SubInAcl 命令 icacls 命令
查看用户权限 subinacl /file "C:\path\to\file" /display=User icacls "C:\path\to\file" /find "User"
给文件夹设置特定用户的权限 subinacl /file "C:\folder" /grant=User=F icacls "C:\folder" /grant User:F
移除文件夹的特定用户权限 subinacl /file "C:\folder" /remove=User icacls "C:\folder" /remove User
修改文件夹权限时指定子目录 subinacl /subdirectories "C:\folder" /grant=User=F icacls "C:\folder\*" /grant User:F
撤销子目录和文件的权限 subinacl /subdirectories "C:\folder" /revoke=User icacls "C:\folder\*" /revoke User
为多个文件设置相同权限 subinacl /file "C:\folder\file1" /grant=User=F /file "C:\folder\file2" /grant=User=F icacls "C:\folder\file1" "C:\folder\file2" /grant User:F
启用/禁用文件夹继承权限 subinacl /file "C:\folder" /setinheritance=1 icacls "C:\folder" /inheritance:e
禁用文件夹继承权限 subinacl /file "C:\folder" /setinheritance=0 icacls "C:\folder" /inheritance:d
显示文件夹和子文件夹的权限 subinacl /subdirectories "C:\folder" /display icacls "C:\folder" /t
为文件或文件夹设置权限并应用到所有子项 subinacl /file "C:\folder" /grant=User=F /subdirectories icacls "C:\folder" /grant User:F /t
恢复文件夹权限继承 subinacl /file "C:\folder" /setinheritance=1 icacls "C:\folder" /inheritance:e
清除文件夹继承并设置文件夹权限 subinacl /file "C:\folder" /setinheritance=0 /grant=User=F icacls "C:\folder" /inheritance:d /grant User:F
查询指定用户是否有权限 subinacl /file "C:\path\to\file" /display=User icacls "C:\path\to\file" /find "User"
为文件夹添加多个用户的权限 subinacl /file "C:\folder" /grant=User1=F /grant=User2=R icacls "C:\folder" /grant User1:F /grant User2:R
设置特定文件的读取权限 subinacl /file "C:\path\to\file" /grant=User=R icacls "C:\path\to\file" /grant User:R
给用户撤销所有文件权限 subinacl /file "C:\path\to\file" /revoke=User icacls "C:\path\to\file" /revoke User
查看文件/文件夹的权限继承详细信息 不支持 icacls "C:\folder" /inheritance
查找具有指定权限的文件 subinacl /file "C:\folder" /find "User" icacls "C:\folder" /find "User"

其他补充说明:

  1. 权限继承控制

    • SubInAcl 和 icacls 都支持对文件夹权限继承进行设置或禁用。
    • icacls 的继承操作(如 /inheritance:e/inheritance:d)更为直观,且有更多的控制选项,例如递归设置(/t 参数)和继承选项。
  2. 批量权限管理

    • 在批量操作方面,SubInAcl 可以通过多个文件或子目录路径直接进行权限设置,但 icacls 也支持通过通配符(如 *)递归处理文件夹内的文件。
    • icacls 更适合管理现代 Windows 系统中的文件和文件夹权限,尤其是在多层次目录结构中。
  3. 命令的易用性

    • SubInAcl 命令较为老旧,且语法上有一些复杂,可能会给初学者带来困难。相对而言,icacls 更为现代化和直观,适合日常使用。
  4. 权限管理备份与恢复

    • icacls 提供了直接的权限备份与恢复功能(如 /save 和 /restore),而 SubInAcl 并未提供类似的功能,因此在权限迁移或备份时,推荐使用 icacls

对于大多数权限管理任务,尤其是涉及文件夹和文件的批量权限设置、继承控制以及权限备份恢复等,icacls 是更为推荐的工具。虽然 SubInAcl 具有一些额外的功能,特别是在处理子目录的继承权限时,但其命令较为繁琐且过时,因此不再作为主要的权限管理工具使用。如果是较新的 Windows 系统,强烈建议使用 icacls 来替代 SubInAcl


补充 SubInAclicacls 命令的等效操作和更多应用示例:

功能/操作 SubInAcl 命令 icacls 命令
给文件或文件夹授予完全控制权限 subinacl /file "C:\path\to\file" /grant=User=F icacls "C:\path\to\file" /grant User:F
给文件或文件夹授予读取权限 subinacl /file "C:\path\to\file" /grant=User=R icacls "C:\path\to\file" /grant User:R
给文件或文件夹授予写入权限 subinacl /file "C:\path\to\file" /grant=User=W icacls "C:\path\to\file" /grant User:W
查看文件或文件夹的权限 subinacl /file "C:\path\to\file" /display icacls "C:\path\to\file"
给多个用户分配权限 subinacl /file "C:\path\to\file" /grant=User1=F /grant=User2=R icacls "C:\path\to\file" /grant User1:F /grant User2:R
清除文件夹权限并应用到子目录 subinacl /file "C:\folder" /setpermissions=none /subdirectories icacls "C:\folder" /reset /t
查看文件夹继承状态 subinacl /file "C:\folder" /displayinheritance icacls "C:\folder" /inheritance
移除文件或文件夹的权限 subinacl /file "C:\path\to\file" /remove=User icacls "C:\path\to\file" /remove User
为文件或文件夹恢复默认权限 subinacl /file "C:\path\to\file" /setinheritance=1 icacls "C:\path\to\file" /reset
设置特定文件或文件夹为只读 subinacl /file "C:\path\to\file" /grant=User=R icacls "C:\path\to\file" /grant User:RX
批量设置文件夹中的权限 subinacl /subdirectories "C:\folder" /grant=User=F icacls "C:\folder\*" /grant User:F
移除文件夹中的所有权限 subinacl /subdirectories "C:\folder" /remove=User icacls "C:\folder\*" /remove User
设置文件夹中所有子文件夹继承权限 subinacl /subdirectories "C:\folder" /setinheritance=1 icacls "C:\folder\*" /inheritance:e
禁用文件夹中所有文件的继承权限 subinacl /subdirectories "C:\folder" /setinheritance=0 icacls "C:\folder\*" /inheritance:d
查找并列出具有特定权限的文件 subinacl /file "C:\folder" /find "User" icacls "C:\folder" /find "User"
批量更改权限并应用到多个文件 subinacl /file "C:\file1" /grant=User=F /file "C:\file2" /grant=User=R icacls "C:\file1" "C:\file2" /grant User:F
为子文件夹启用或禁用权限继承 subinacl /file "C:\folder" /setinheritance=1 /subdirectories icacls "C:\folder\*" /inheritance:e

其他常见的 SubInAcl 和 icacls 比较与应用:

  1. 对文件和文件夹权限进行备份与恢复:

    • icacls 提供了强大的权限备份和恢复功能,适用于整个目录树或者单个文件。命令如:
      • 备份权限:
        bashCopy Code
        icacls "C:\folder" /save "permissions_backup.txt"
      • 恢复权限:
        bashCopy Code
        icacls "C:\folder" /restore "permissions_backup.txt"
      • SubInAcl 没有原生的备份与恢复功能,通常需要手动记录权限设置。
  2. 批量操作和递归权限修改:

    • icacls/t 参数可以让用户递归地设置文件夹及子文件夹的权限:

      bashCopy Code
      icacls "C:\folder" /grant User:F /t

      这个命令会将 C:\folder 文件夹及其所有子文件夹中的文件授予 User 完全控制权限。

    • SubInAcl 通过 /subdirectories 选项来递归处理子文件夹权限:

      bashCopy Code
      subinacl /subdirectories "C:\folder" /grant=User=F
  3. 文件继承的启用与禁用:

    • 在权限继承的管理上,icacls 提供了非常清晰的控制选项:

      • 启用继承:
        bashCopy Code
        icacls "C:\folder" /inheritance:e
      • 禁用继承:
        bashCopy Code
        icacls "C:\folder" /inheritance:d
    • SubInAcl 则通过 /setinheritance 参数来启用或禁用继承权限:

      • 启用继承:
        bashCopy Code
        subinacl /file "C:\folder" /setinheritance=1
      • 禁用继承:
        bashCopy Code
        subinacl /file "C:\folder" /setinheritance=0
  4. 权限查看与修改:

    • icacls 允许通过 /find 参数列出某一用户或组在文件中的权限,例如:
      bashCopy Code
      icacls "C:\folder" /find "User"
    • SubInAcl 的权限显示则通常是通过 /display 参数:
      bashCopy Code
      subinacl /file "C:\folder" /display
  • SubInAcl 是一个较为过时的工具,主要用于较旧的 Windows 系统。它虽然支持一些复杂的权限操作,如子目录权限的继承和批量修改,但其语法较为复杂。
  • icacls 是现代 Windows 系统的推荐工具,提供了更强大的权限管理功能,包括权限备份与恢复、继承控制、递归权限操作等,且命令更为简洁易懂。

对于日常的文件和文件夹权限管理,尤其是在较新版本的 Windows 操作系统中,icacls 是更为推荐的工具,而 SubInAcl 在老旧系统或需要兼容的场景中仍然有一定的应用价值。

 


补充 SubInAcl 和 icacls 命令的应用场景和示例:


5. 管理文件和文件夹的所有者

修改文件/文件夹的所有者

  • SubInAcl 和 icacls 都支持修改文件和文件夹的所有者,但是命令的语法和细节略有不同。

SubInAcl

  • 使用 /owner 参数可以更改文件或文件夹的所有者。
    bashCopy Code
    subinacl /file "C:\folder" /owner=User

icacls

  • 使用 /setowner 参数可以设置文件或文件夹的所有者。
    bashCopy Code
    icacls "C:\folder" /setowner User

6. 移除所有权限设置

SubInAcl

  • 使用 /reset 参数可以重置文件或文件夹的权限。
    bashCopy Code
    subinacl /file "C:\folder" /reset

icacls

  • 使用 /reset 参数也可以清除文件的所有权限设置。
    bashCopy Code
    icacls "C:\folder" /reset

如果想递归地清除文件夹内所有子文件和子文件夹的权限,可以加上 /t 参数:

bashCopy Code
icacls "C:\folder" /reset /t

7. 批量修改权限和继承

如果你需要在整个目录中批量修改文件权限,可以通过递归方式进行操作。
SubInAcl 支持递归子目录的权限修改,语法如下:

bashCopy Code
subinacl /subdirectories "C:\folder" /grant=User:F

这个命令会将 C:\folder 下所有文件和子文件夹都赋予 User 完全控制权限。

icacls 也支持类似的操作,使用 /t 参数进行递归:

bashCopy Code
icacls "C:\folder" /grant User:F /t

8. 限制权限(拒绝访问)

SubInAcl

  • 如果你想要拒绝某个用户对文件或文件夹的访问权限,可以使用 /deny 参数:
    bashCopy Code
    subinacl /file "C:\folder" /deny=User:R
    这条命令将拒绝 User 对 C:\folder 文件夹的读取权限。

icacls

  • 使用 /deny 参数也可以拒绝某个用户或组的访问权限:
    bashCopy Code
    icacls "C:\folder" /deny User:R

9. 继承权限的管理

SubInAclicacls 都允许你在文件夹或文件中管理权限继承。继承意味着文件或文件夹可以从父文件夹自动继承权限。

  • SubInAcl

    • 启用继承:
      bashCopy Code
      subinacl /file "C:\folder" /setinheritance=1
    • 禁用继承:
      bashCopy Code
      subinacl /file "C:\folder" /setinheritance=0
  • icacls

    • 启用继承:
      bashCopy Code
      icacls "C:\folder" /inheritance:e
    • 禁用继承:
      bashCopy Code
      icacls "C:\folder" /inheritance:d

/inheritance:e 表示启用继承,/inheritance:d 表示禁用继承。继承关系禁用后,文件或文件夹将不再从父级文件夹继承权限。


10. 比较权限

有时你可能希望查看不同用户对同一个文件或文件夹的权限。虽然 SubInAclicacls 都不直接支持权限比较功能,但你可以通过将权限输出到文件来手动进行比较。

SubInAcl

  • 输出权限信息到文本文件:
    bashCopy Code
    subinacl /file "C:\folder" /display > "permissions.txt"

icacls

  • 将权限信息保存到文本文件:
    bashCopy Code
    icacls "C:\folder" > "permissions.txt"

然后你可以打开保存的文本文件,通过文本编辑器来比较权限设置。


11. 备份和恢复文件夹权限(icacls

icacls 提供了非常方便的权限备份与恢复功能。通过 /save/restore 参数,你可以轻松备份和恢复文件夹的权限设置。

  • 备份权限

    bashCopy Code
    icacls "C:\folder" /save "permissions_backup.txt"

    这将把 C:\folder 中的权限保存到名为 permissions_backup.txt 的文件中。

  • 恢复权限

    bashCopy Code
    icacls "C:\folder" /restore "permissions_backup.txt"

    这会将之前保存的权限恢复到 C:\folder


12. 错误处理与输出日志

在执行权限修改时,可能会出现权限不足或文件锁定等问题。icaclsSubInAcl 都提供了错误处理的功能,能够将日志输出到指定的文件。

  • SubInAcl

    • 使用 /log 参数将操作日志输出到指定文件:
      bashCopy Code
      subinacl /file "C:\folder" /grant=User:F /log="C:\log.txt"
  • icacls

    • 使用 > output.log 将操作结果输出到文件:
      bashCopy Code
      icacls "C:\folder" /grant User:F > output.log

通过这种方式,你可以更好地管理和监控权限操作,避免出现误操作导致的权限问题。


总结与建议

  • SubInAcl 是一个较老的工具,主要用于旧版本的 Windows 系统中,虽然它能够执行很多复杂的权限管理任务,但其语法复杂且较难操作,且在现代 Windows 系统中支持已逐渐被淘汰。

  • icacls 是现代 Windows 操作系统的首选工具,提供了更多的功能,例如权限备份与恢复、权限继承的管理、错误处理等。此外,icacls 的命令行语法更简洁直观,适合日常使用。

对于现代 Windows 系统,icacls 是更为推荐的工具,尤其是在大规模权限管理和自动化任务中。对于较旧的系统或者一些特殊的需求,SubInAcl 仍然有其应用场景。

如果你是进行日常的文件权限管理和维护,尤其是在 Windows 7 及以后的版本中,icacls 是更推荐的工具。如果你是在进行批量操作或者处理历史遗留的权限管理任务,SubInAcl 可能依然有一定的价值。

 


SubInAcl 与 icacls 的对比

以下是 SubInAclicacls 工具在功能、适用场景和使用方式上的主要区别。为了方便理解,我将这些区别以表格的形式呈现。

特性 SubInAcl icacls
发布年份 2003年(Windows Server 2003 和 Windows XP) 2008年(Windows Vista 及之后版本)
操作系统支持 主要适用于 Windows Server 2003、Windows XP 及早期版本 适用于 Windows Vista 及之后版本(包括 Windows 10)
命令行工具类型 专注于 ACL 管理,具有丰富的访问控制管理功能 用于查看、修改、备份和恢复文件系统和文件夹的权限
功能强度 更侧重于批量权限管理,支持大规模的 ACL 变更和处理 更现代、直观,适用于文件权限设置和继承控制,更简洁易用
支持的对象 支持文件、文件夹、注册表项、共享、服务等 主要支持文件和文件夹的权限管理,无法直接操作注册表等
继承管理 支持权限继承控制,可以设置继承规则 支持继承设置(使用 /inheritance 参数)
权限修改精度 允许更细粒度的权限修改,支持给用户、组和其他对象分配各种权限 支持标准的权限设置,如完全控制、读取、写入等,但较少自定义
批量处理 支持批量修改权限和 ACL,适用于大量文件、目录的权限操作 支持批量处理文件权限,但不像 SubInAcl 那样自动化
脚本化和自动化 支持较为复杂的脚本化和自动化任务(如批量授权、修复权限等) 支持脚本化(尤其适合批量修改文件夹权限)
用户界面 无图形界面,完全基于命令行操作 无图形界面,基于命令行操作,但命令更简单易懂
常见用途 适用于大规模权限修复、迁移、跨多个对象的权限管理 主要用于文件和文件夹的权限设置,常用于日常的权限管理任务
支持的系统权限 支持 NTFS 文件系统权限、注册表权限、服务权限等多种资源的管理 主要支持 NTFS 文件和文件夹的权限,不支持注册表等其他系统资源
兼容性 兼容较老的 Windows 版本(如 Windows XP 和 Windows Server 2003) 与现代 Windows 系统兼容,如 Windows 7、8、10、Server 2008+
是否废弃 是的,微软推荐使用 icacls 替代。 否,icacls 是现代 Windows 中推荐的权限管理工具
权限类型 支持标准权限、继承权限、授权控制、强制权限等更复杂的权限设置 支持常规权限(完全控制、修改、读取、写入、执行等)

详细说明

  • SubInAcl

    • 适用于较旧的 Windows 操作系统(如 Windows Server 2003 和 Windows XP)。
    • 强调批量权限修改、跨多个对象操作,适用于需要批量管理权限的任务。
    • 支持多种资源类型的权限管理,包括文件、注册表项、共享、服务等,但没有图形界面。
    • 适合需要复杂权限管理的高级用户,但因微软逐渐停止对其的支持,因此已经不再推荐使用。
  • icacls

    • 适用于 Windows Vista 及更高版本的 Windows 操作系统,包括 Windows 7、8、10、Server 2008+。
    • 更现代、易于使用,命令语法简洁,适合普通用户以及管理员日常使用。
    • 专注于文件系统(NTFS)权限管理,支持权限备份、恢复和继承管理等。
    • 微软推荐使用 icacls 作为替代工具,并且随着系统更新,icacls 已经集成到新的 Windows 操作系统中,提供更强的兼容性和功能。

总结

  • SubInAcl 更加适合老旧系统和批量、复杂的权限管理,适合特定场景中的高效权限管理,但微软不再对其更新。
  • icacls 是现代 Windows 系统中推荐的权限管理工具,功能现代、简洁,易于日常使用,并且具有更好的兼容性和支持。

什么是 SubInAcl 版本 5.2.3790.1180?

SubInAcl 是微软提供的一个命令行工具,用于管理文件、文件夹、注册表项和其他对象的访问控制列表(ACL)。它允许用户查看、修改和配置系统中各种资源的权限。SubInAclSubInAcl.exe 程序的一部分,通常用于自动化安全性管理任务,如批量更改文件或注册表项的权限。

版本号 5.2.3790.1180 是此工具的一特定版本,代表它是 Windows Server 2003Windows XP 环境中常见的一版本。具体来说,版本号中的 5.2.3790 是 Windows Server 2003/Windows XP Professional x64 Edition 中的版本标识符。

主要功能

SubInAcl 主要用于以下几种任务:

  1. 查看和修改 ACL
    你可以使用 SubInAcl 查看文件、文件夹、注册表项、共享等对象的 ACL(访问控制列表)和权限。它能够显示该对象的权限和用户/组的授权信息。

  2. 设置权限
    它可以为文件、文件夹、注册表项等资源设置或修改权限。例如,你可以为某个文件夹添加用户权限或修改一个注册表项的权限。

  3. 批量处理
    SubInAcl 支持对多个文件、文件夹、注册表项等执行批量权限操作,使其在大型环境中管理权限变得更加方便。

  4. 继承权限
    SubInAcl 可以设置或修改对象的权限继承规则,允许父对象的权限继承到子对象。

版本 5.2.3790.1180 的背景

版本 5.2.3790.1180 属于 Windows Server 2003Windows XP Professional x64 Edition 的支持版本。在这些版本的 Windows 中,SubInAcl 被广泛用于管理系统的权限设置,特别是在批量修改权限或修复权限问题时。

该版本可以在这些操作系统上安装和运行,但并不适用于更新的 Windows 版本。随着 Windows Vista 和更高版本的推出,Microsoft 更推荐使用 icaclstakeown 等工具来替代 SubInAcl,因为这些工具在新的 Windows 系统中更为现代和灵活。

为什么使用 SubInAcl

尽管 SubInAcl 已不再是 Microsoft 当前的首选工具,但它在某些场景下仍然具有价值,尤其是在较老的系统(如 Windows XP 和 Windows Server 2003)上。

  1. 兼容性:在旧版本的 Windows 上,SubInAcl 是管理权限和 ACL 的标准工具,很多旧系统管理员依赖它来批量操作文件和文件夹权限。

  2. 自动化:SubInAcl 支持脚本化操作,适合用于自动化权限修复、批量授权等工作,特别是在迁移或恢复系统时。

  3. 灵活性:它能非常详细地控制对象的权限,并支持广泛的权限配置选项,适用于需要精细控制权限的高级用户。

如何使用 SubInAcl

例如,你可以使用 SubInAcl 来为文件夹设置权限。以下是一个简单的命令行示例:

bashCopy Code
subinacl /file "C:\MyFolder" /grant=Domain\Username=F
  • /file "C:\MyFolder":指定文件夹路径。
  • /grant=Domain\Username=F:授予指定的用户 F(完全控制)权限。

此外,SubInAcl 还支持更多的选项和参数,例如设置继承权限、查看当前权限、删除权限等。

总结

SubInAcl 版本 5.2.3790.1180 是一个用于 Windows Server 2003 和 Windows XP 的工具,主要用于管理文件、文件夹、注册表项等对象的访问控制列表(ACL)。虽然它现在在新版本的 Windows 中已不再常用,但它在一些老旧系统和需要自动化权限管理的场景中仍然具有一定的价值。如果你正在使用 Windows 10 或更高版本,建议使用更现代的工具如 icacls 来进行权限管理。


 

SubInAcl 工具按功能分类的表格:

功能分类 命令选项 描述
输出日志和错误日志 /outputlog=文件名<br>/errorlog=文件名 指定输出和错误日志文件名
显示详细信息 /verbose (默认)<br>//noverbose 显示详细信息或不显示详细信息
测试模式 /testmode<br>//notestmode (默认) 启用或禁用测试模式
环境变量扩展 /expandenvironmentsymbols (默认)<br>//noexpandenvironmentsymbols 是否扩展环境变量
统计信息 /statistic (默认)<br>//nostatistic 显示或不显示统计信息
字符串替换 /stringreplaceonoutput=字符串1=字符串2 在输出中替换指定的字符串
SAM 服务器和文件 /alternatesamserver=SamServer<br>//offlinesam=文件名 指定备用 SAM 服务器或离线 SAM 文件
跨重解析点 /nocrossreparsepoint (默认)<br>//crossreparsepoint 是否跨越重解析点
SID 相关操作 /dumpcachedsids=文件名<br>//findsid=[域名\]账户<br>//suppresssid=[域名\]账户 转储缓存的 SID,查找 SID,抑制 SID
安全描述符操作 `/display[=dacl sacl
SID 清理 `/cleandeletedsidsfrom=域名[=dacl sacl
访问检查 /accesscheck=[域名\]用户名 检查访问权限
主组设置 /setprimarygroup=[域名\]组 设置对象的主组
权限管理 /grant=[域名\]用户名[=权限]<br>//deny=[域名\]用户名[=权限]<br>//revoke=[域名\]用户名 授予、拒绝、撤销权限
SID 权限管理 /sgrant=[域名\]用户名[=权限]<br>//sdeny=[域名\]用户名[=权限]<br>//sallowdeny=[域名\]用户名[=权限] 为 SID 授予、拒绝、允许/拒绝权限
路径和对象排除 /pathexclude=模式<br>//objectexclude=模式 排除路径匹配的项或对象匹配的项
SDDL 操作 /sddl=sddl_字符串 使用指定的 SDDL 字符串设置或显示安全描述符
安全描述符复制 /objectcopysecurity=对象路径<br>//pathcopysecurity=路径容器 复制对象或路径的安全描述符
域和服务器迁移 /changedomain=旧域名=新域名[=映射文件[=Both]]<br>//migratetodomain=源域名=目标域名=[映射文件[=Both]] 域名更改和迁移操作
账户迁移 /accountmigration=[域名\]旧账户=[域名\]新账户 执行账户迁移操作
SID 查找和替换 /replace=[域名\]旧账户=[域名\]新账户 替换指定账户的 SID

说明:

  • /testmode 和 /verbose 等选项主要用于工具的操作调试和验证。
  • /grant/deny/revoke 等是用来设置或撤销权限的常用命令。
  • /display 和 /compactsecuritydescriptor 可以用来查看和修改对象的安全描述符。
  • /changedomain/migratetodomain/accountmigration 等命令用于处理域和账户迁移的任务。

SubInAcl 工具的命令按功能分类的表格:

功能分类 命令选项 描述
输出日志和错误日志 /outputlog=文件名<br>/errorlog=文件名 指定输出和错误日志文件名
显示详细信息 /verbose<br>/noverbose 显示详细信息或不显示详细信息
测试模式 /testmode<br>/notestmode 启用或禁用测试模式
环境变量扩展 /expandenvironmentsymbols<br>/noexpandenvironmentsymbols 是否扩展环境变量
统计信息 /statistic<br>/nostatistic 显示或不显示统计信息
字符串替换 /stringreplaceonoutput=字符串1=字符串2 在输出中替换指定的字符串
SAM 服务器和文件 /alternatesamserver=SamServer<br>/offlinesam=文件名 指定备用 SAM 服务器或离线 SAM 文件
跨重解析点 /nocrossreparsepoint<br>/crossreparsepoint 是否跨越重解析点
SID 相关操作 /dumpcachedsids=文件名<br>/findsid=[域名\]账户<br>/suppresssid=[域名\]账户 转储缓存的 SID,查找 SID,抑制 SID
安全描述符操作 `/display[=dacl sacl
SID 清理 `/cleandeletedsidsfrom=域名[=dacl sacl
访问检查 /accesscheck=[域名\]用户名 检查访问权限
主组设置 /setprimarygroup=[域名\]组 设置对象的主组
权限管理 /grant=[域名\]用户名[=权限]<br>/deny=[域名\]用户名[=权限]<br>/revoke=[域名\]用户名 授予、拒绝、撤销权限
SID 权限管理 /sgrant=[域名\]用户名[=权限]<br>/sdeny=[域名\]用户名[=权限]<br>/sallowdeny=[域名\]用户名[=权限] 为 SID 授予、拒绝、允许/拒绝权限
路径和对象排除 /pathexclude=模式<br>/objectexclude=模式 排除路径匹配的项或对象匹配的项
SDDL 操作 /sddl=sddl_字符串 使用指定的 SDDL 字符串设置或显示安全描述符
安全描述符复制 /objectcopysecurity=对象路径<br>/pathcopysecurity=路径容器 复制对象或路径的安全描述符
域和服务器迁移 /changedomain=旧域名=新域名[=映射文件[=Both]]<br>//migratetodomain=源域名=目标域名=[映射文件[=Both]] 域名更改和迁移操作
账户迁移 /accountmigration=[域名\]旧账户=[域名\]新账户 执行账户迁移操作
SID 查找和替换 /replace=[域名\]旧账户=[域名\]新账户 替换指定账户的 SID

说明:

  • /testmode 和 /verbose 等选项主要用于调试和验证命令的执行。
  • /grant/deny/revoke 等命令用于权限的授予、拒绝和撤销。
  • /display 和 /compactsecuritydescriptor 用于查看或修改安全描述符。
  • /changedomain 和 /migratetodomain 等用于处理域和账户的迁移操作。

 


SubInAcl 版本 5.2.3790.1180

使用说明


用法:

Copy Code
SubInAcl [/选项...] /对象类型 对象名称 [[/操作[=参数]...]]

/选项:

  • /outputlog=文件名 :指定输出日志文件名
  • /errorlog=文件名 :指定错误日志文件名
  • /noverbose :不显示详细信息
  • /verbose (默认) :显示详细信息
  • /notestmode (默认) :不使用测试模式
  • /testmode :使用测试模式
  • /alternatesamserver=SamServer :指定备用 SAM 服务器
  • /offlinesam=文件名 :指定离线 SAM 文件
  • /stringreplaceonoutput=字符串1=字符串2 :在输出中替换字符串
  • /expandenvironmentsymbols (默认):扩展环境变量
  • /noexpandenvironmentsymbols :不扩展环境变量
  • /statistic (默认) :显示统计信息
  • /nostatistic :不显示统计信息
  • /dumpcachedsids=文件名 :转储缓存的 SID
  • /separator=字符 :指定分隔符
  • /applyonly=[dacl,sacl,owner,group] :仅应用于指定的安全描述符部分
  • /nocrossreparsepoint (默认) :不跨越重解析点
  • /crossreparsepoint :跨越重解析点

/对象类型:

  • /service :服务
  • /keyreg :注册表项
  • /subkeyreg :注册表子项
  • /file :文件
  • /subdirectories[=仅目录|仅文件] :子目录
  • /clustershare :集群共享
  • /kernelobject :内核对象
  • /metabase :元数据库
  • /printer :打印机
  • /onlyfile :仅文件
  • /process :进程
  • /share :共享
  • /samobject :SAM 对象

/操作:

  • /display[=dacl|sacl|owner|primarygroup|sdsize|sddl] (默认):显示指定的安全描述符部分
  • /setowner=所有者 :设置对象所有者
  • /replace=[域名\]旧账户=[域名\]新账户 :替换账户
  • /accountmigration=[域名\]旧账户=[域名\]新账户 :账户迁移
  • /changedomain=旧域名=新域名[=映射文件[=Both]] :更改域名
  • /migratetodomain=源域名=目标域名=[映射文件[=Both]] :迁移到新域
  • /findsid=[域名\]账户[=stop|continue] :查找 SID
  • /suppresssid=[域名\]账户 :抑制 SID
  • /confirm :确认操作
  • /ifchangecontinue :如果有变化则继续
  • /cleandeletedsidsfrom=域名[=dacl|sacl|owner|primarygroup|all] :清理已删除的 SID
  • /testmode :测试模式
  • /accesscheck=[域名\]用户名 :检查访问权限
  • /setprimarygroup=[域名\]组 :设置主组
  • /grant=[域名\]用户名[=权限] :授予权限
  • /deny=[域名\]用户名[=权限] :拒绝权限
  • /sgrant=[域名\]用户名[=权限] :为 SID 授予权限
  • /sdeny=[域名\]用户名[=权限] :为 SID 拒绝权限
  • /sallowdeny==[域名\]用户名[=权限] :允许/拒绝 SID 权限
  • /revoke=[域名\]用户名 :撤销权限
  • /perm :查看权限
  • /audit :查看审计
  • /compactsecuritydescriptor :压缩安全描述符
  • /pathexclude=模式 :排除路径匹配的项
  • /objectexclude=模式 :排除对象匹配的项
  • /sddl=sddl_字符串 :指定 SDDL 字符串
  • /objectcopysecurity=对象路径 :复制对象的安全描述符
  • /pathcopysecurity=路径容器 :复制路径的安全描述符

用法:

Copy Code
SubInAcl [/选项...] /playfile 文件名

用法:

Copy Code
SubInAcl /help [关键字]
SubInAcl /help /full

关键字可以是:

  • features 使用功能

  • usage 使用说明

  • syntax 语法

  • sids SID

  • view_mode 查看模式

  • test_mode 测试模式

  • object_type 对象类型

  • domain_migration 域迁移

  • server_migration 服务器迁移

  • substitution_features 替换功能

  • editing_features 编辑功能

  • 或 -

Copy Code
任何 [/选项] [/操作] [/对象类型]

 


 

posted @ 2024-12-31 16:03  suv789  阅读(488)  评论(0)    收藏  举报