icacls
- C:\Windows\system32\icacls.exe /?
Output:
ICACLS <名前> /save <ACL ファイル> [/T] [/C] [/L] [/Q]
名前が一致するすべてのファイルとフォルダーの DACL を <ACL ファイル> に
格納して、後で /restore で指定できるようにします。SACL、所有者、整合性
ラベルは保存されません。
ICACLS <ディレクトリ> [/substitute <旧 SID> <新 SID> [...]] /restore <ACL ファ
イル> [/C] [/L] [/Q]
格納されている DACL を <ディレクトリ> 内のファイルに適用します。
ICACLS <名前> /setowner <ユーザー> [/T] [/C] [/L] [/Q]
すべての一致する名前の所有者を変更します。このオプションでは、所有権の
変更を強制することはできません。所有権を変更するには、takeown.exe
ユーティリティを使用してください。
ICACLS <名前> /findsid <SID> [/T] [/C] [/L] [/Q]
<SID> が明示されている ACL を含むすべての一致する名前を検索します。
ICACLS <名前> /verify [/T] [/C] [/L] [/Q]
ACL が正規の形式ではないか長さが ACE 数と一致しないすべてのファイルを
検索します。
ICACLS <名前> /reset [/T] [/C] [/L] [/Q]
すべての一致するファイルについて、ACL を継承された既定の ACL と置換します。
ICACLS <名前> [/grant[:r] <SID>:perm[...]]
[/deny <SID>:perm [...]]
[/remove[:g|:d]] <SID>[...]] [/T] [/C] [/L] [/Q]
[/setintegritylevel Level:policy[...]]
/grant[:r] <SID>:perm は、指定されたユーザー アクセス権を付与します。
:r を指定すると、以前に付与されたすべての明示的なアクセス許可は新しい
アクセス許可に置き換えられます。
:r を指定しない場合、新しいアクセス許可は以前に付与された明示的な
アクセス許可に追加されます。
/deny <SID>:perm は、指定されたユーザー アクセス権を明示的に拒否します。
指定されたアクセス許可に対応する明示的な拒否 ACE が追加され、明示的な
許可内容に含まれる同じアクセス許可は削除されます。
/remove[:[g|d]] <SID> は、ACL 内にあるすべての <SID> を削除します。
:g を指定すると、その SID に対して許可されたすべての権限を ACL から
削除します。
:d を指定すると、その SID に対して拒否されたすべての権限を ACL から
削除します。
/setintegritylevel [(CI)(OI)] レベルは、すべての一致するファイルに整合性
ACE を追加します。このレベルは次の 1 つとして指定されます。
L[ow]
M[edium]
H[igh]
整合性 ACE の継承オプションは、レベルの前に配置でき、
ディレクトリに対してのみ適用されます。
/inheritance:e|d|r
e - 継承を有効にします。
d - 継承を無効にし、ACE をコピーします。
r - 継承された ACE をすべて削除します。
注意:
<SID> は数値形式またはフレンドリ名形式で指定できます。数値形式の場合は、
SID の始めに * を付けます。
/T は、<名前> で指定されたディレクトリ以下のすべての一致するファイルと
ディレクトリに対してこの処理が実行されることを指定します。
/C は、どのようなファイル エラーが発生してもこの処理が続行されることを
指定します。ただしエラー メッセージは表示されます。
/L は、この処理がターゲットではなくシンボリック リンク自体に対して実行
されることを指定します。
/Q は、icacls が成功のメッセージを抑制することを指定します。
ICACLS は、ACE エントリの正規の順序を維持します:
明示的な拒否内容
明示的な許可内容
継承された拒否内容
継承された許可内容
perm はアクセス許可マスクであり、次の 2 種類の方法で指定できます:
単純な権限を列挙:
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 <ACL ファイル> /T
- c:\windows より下にあるすべてのファイルとサブディレクトリの ACL を
<ACL ファイル> に保存します。
icacls c:\windows\ /restore <ACL ファイル>
- <ACL ファイル> 内のファイルのうち c:\windows とそのサブディレクトリ
内に存在するすべてのファイルの ACL を復元します。
icacls <ファイル> /grant Administrator:(D,WDAC)
- Administrator ユーザーに、<ファイル> に対する削除および DAC 書き込み
のアクセス許可を与えます。
icacls <ファイル> /grant *S-1-1-0:(D,WDAC)
- SID S-1-1-0 によって定義されたユーザーに、<ファイル> に対する削除
および DAC 書き込みのアクセス許可を与えます。
ICACLS name /save aclfile [/T] [/C] [/L] [/Q]
stores the DACLs for the files and folders that match the name
into aclfile for later use with /restore. Note that SACLs,
owner, or integrity labels are not saved.
ICACLS directory [/substitute SidOld SidNew [...]] /restore aclfile
[/C] [/L] [/Q]
applies the stored DACLs to files in directory.
ICACLS name /setowner user [/T] [/C] [/L] [/Q]
changes the owner of all matching names. This option does not
force a change of ownership; use the takeown.exe utility for
that purpose.
ICACLS name /findsid Sid [/T] [/C] [/L] [/Q]
finds all matching names that contain an ACL
explicitly mentioning Sid.
ICACLS name /verify [/T] [/C] [/L] [/Q]
finds all files whose ACL is not in canonical form or whose
lengths are inconsistent with ACE counts.
ICACLS name /reset [/T] [/C] [/L] [/Q]
replaces ACLs with default inherited ACLs for all matching files.
ICACLS name [/grant[:r] Sid:perm[...]]
[/deny Sid:perm [...]]
[/remove[:g|:d]] Sid[...]] [/T] [/C] [/L] [/Q]
[/setintegritylevel Level:policy[...]]
/grant[:r] Sid:perm grants the specified user access rights. With :r,
the permissions replace any previously granted explicit permissions.
Without :r, the permissions are added to any previously granted
explicit permissions.
/deny Sid:perm explicitly denies the specified user access rights.
An explicit deny ACE is added for the stated permissions and
the same permissions in any explicit grant are removed.
/remove[:[g|d]] Sid removes all occurrences of Sid in the ACL. With
:g, it removes all occurrences of granted rights to that Sid. With
:d, it removes all occurrences of denied rights to that Sid.
/setintegritylevel [(CI)(OI)]Level explicitly adds an integrity
ACE to all matching files. The level is to be specified as one
of:
L[ow]
M[edium]
H[igh]
Inheritance options for the integrity ACE may precede the level
and are applied only to directories.
/inheritance:e|d|r
e - enables inheritance
d - disables inheritance and copy the ACEs
r - remove all inherited ACEs
Note:
Sids may be in either numerical or friendly name form. If a numerical
form is given, affix a * to the start of the SID.
/T indicates that this operation is performed on all matching
files/directories below the directories specified in the name.
/C indicates that this operation will continue on all file errors.
Error messages will still be displayed.
/L indicates that this operation is performed on a symbolic link
itself versus its target.
/Q indicates that icacls should suppress success messages.
ICACLS preserves the canonical ordering of ACE entries:
Explicit denials
Explicit grants
Inherited denials
Inherited grants
perm is a permission mask and can be specified in one of two forms:
a sequence of simple rights:
N - no access
F - full access
M - modify access
RX - read and execute access
R - read-only access
W - write-only access
D - delete access
a comma-separated list in parentheses of specific rights:
DE - delete
RC - read control
WDAC - write DAC
WO - write owner
S - synchronize
AS - access system security
MA - maximum allowed
GR - generic read
GW - generic write
GE - generic execute
GA - generic all
RD - read data/list directory
WD - write data/add file
AD - append data/add subdirectory
REA - read extended attributes
WEA - write extended attributes
X - execute/traverse
DC - delete child
RA - read attributes
WA - write attributes
inheritance rights may precede either form and are applied
only to directories:
(OI) - object inherit
(CI) - container inherit
(IO) - inherit only
(NP) - don't propagate inherit
(I) - permission inherited from parent container
Examples:
icacls c:\windows\* /save AclFile /T
- Will save the ACLs for all files under c:\windows
and its subdirectories to AclFile.
icacls c:\windows\ /restore AclFile
- Will restore the Acls for every file within
AclFile that exists in c:\windows and its subdirectories.
icacls file /grant Administrator:(D,WDAC)
- Will grant the user Administrator Delete and Write DAC
permissions to file.
icacls file /grant *S-1-1-0:(D,WDAC)
- Will grant the user defined by sid S-1-1-0 Delete and
Write DAC permissions to file.
Return Code: 0
C:\Windows\system32\icacls.exe
c:\>ver
Microsoft Windows [Version 10.0.19045.2075]
| File | Info |
|---|---|
| File Size | 39424bytes |
| Creation Time | 2019/12/07 18:09:33 |
| LastWrite Time | 2019/12/07 18:09:33 |
| ProductVersion | 10.0.19041.1889 |
| FileVersion | 10.0.19041.1889 (WinBuild.160101.0800) |
| Hash | Value |
|---|---|
| MD5 | 48c87e3b3003a2413d6399ea77707f5d |
| SHA1 | 2b52b53fab6c50f3852f55b786ff16d7fe25bcb8 |
| SHA224 | 727b556498c1b55fbee5c6a94478442145d5b561765f515df68c0c8e |
| SHA256 | 222ea0e9d8ed1d337dbaedd75a13b8f28fa5c3711dcdf4307e75cede5b5f6b9a |
| SHA384 | e590f892766ecbead37867c99c63366bfb74db4eb82ba66f674c03e6129a8cc50e97a9225b6f94fcdd020932d0708244 |
| SHA512 | 503d567172d532040b9ef0cbbd9b7d8bad1f2afa41acb68b19ab91775b69ad327bfbd907102fa9a8e0c99e9b7e9b1e3c20d720839dadc7b94ac819c6a4d5d9e3 |