次の方法で共有


icacls

指定したファイルの随意アクセス制御リスト (DACL) を表示または変更し、指定したディレクトリ内のファイルに格納された DACL を適用します。

Note

This command replaces the deprecated cacls command.

Syntax

icacls name [/save aclfile] [/setowner user] [/findsid Sid] [/verify] [/reset] [/T] [/C] [/L] [/Q]
icacls name [/grant[:r] Sid:perm[...]] [/deny Sid:perm [...]] [/remove[:g|:d]] Sid[...]]] [/setintegritylevel Level:policy[...]] [/T] [/C] [/L] [/Q]
icacls directory [/substitute SidOld SidNew [...]] [/restore aclfile] [/C] [/L] [/Q]

Parameters

Parameter Description
<name> DACL を表示または変更するファイルを指定します。
<directory> DACL を表示または変更するディレクトリを指定します。
/t 現在のディレクトリとそのサブディレクトリ内の指定されたすべてのファイルに対して操作を実行します。
/c ファイル エラーが発生した場合でも操作を続行します。 エラー メッセージは引き続き表示されます。
/l リンク先ではなくシンボリック リンクに対して操作を実行します。
/q 成功メッセージを抑制します。
/セーブ <ACLfile> 一致するすべてのファイルの DACL をアクセス制御リスト (ACL) ファイルに格納し、後で /restore で使用できるようにします。
/setowner <user> 一致するすべてのファイルの所有者を指定したユーザーに変更します。
/findsid <sid> 指定したセキュリティ識別子 (SID) を明示的にメンションする DACL を含む一致するすべてのファイルを検索します。
/verify ACL が正規ではない、または長さがアクセス制御エントリ (ACE) の数と一致しないすべてのファイルを検索します。
/reset ACL を、一致するすべてのファイルの既定の継承された ACL に置き換えます。
/grant[:r] <sid>:<perm> 指定したユーザー アクセス権を付与します。 アクセス許可は、以前に付与された明示的なアクセス許可を置き換えます。 Not adding :r means that permissions are added to any previously granted explicit permissions.
/deny <sid>:<perm> 指定されたユーザー アクセス権を明示的に拒否します。 指定されたアクセス許可に対して明示的な拒否 ACE が追加され、明示的な許可と同じアクセス許可が削除されます。
/remove: g |d <sid> 指定した SID のすべての出現箇所を DACL から削除します。 このコマンドでは、次のコマンドを使用することもできます。

  • g - Removes all occurrences of granted rights to the specified SID
  • d - Removes all occurrences of denied rights to the specified SID
  • /setintegritylevel <perm><level> 一致するすべてのファイルに整合性 ACE を明示的に追加します。 レベルは次のように指定できます。

  • l - Low
  • m - Medium
  • h - High

  • 整合性 ACE の継承オプションは、レベルの前にあり、ディレクトリにのみ適用されます。
    /代える <sidold><sidnew> Replaces an existing SID (sidold) with a new SID (sidnew). <directory> パラメーターで使用する必要があります。
    /restore <ACLfile> /c | /l | /q <ACLfile> から、指定したディレクトリ内のファイルに格納された DACL を適用します。 <directory> パラメーターで使用する必要があります。
    /inheritancelevel: e |d |r 継承レベルを設定します。次のことができます。

  • e - Enables inheritance
  • d - Disables inheritance and copies the ACEs
  • r - Disables inheritance and removes only inherited ACEs
  • Remarks

    • SID は、数値形式またはフレンドリ名形式のいずれかになります。 数値形式を使用する場合は、SID の先頭にワイルドカード文字 * を貼り付けます。

    • このコマンドは、ACE エントリの正規の順序を次のように保持します。

      • Explicit denials

      • Explicit grants

      • Inherited denials

      • Inherited grants

    • <perm> オプションは、基本権限、高度な権限、または継承権限に指定できるアクセス許可マスクです。

      • かっこを使用する必要のない一連の単純な権限 (基本的なアクセス許可):

        • 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
      • かっこを使用する必要がある特定の権限 (高度なアクセス許可) のコンマ区切りのリスト。

        • DE - Delete
        • RC - Read control (read permissions)
        • WDAC - Write DAC (change permissions)
        • WO - Write owner (take ownership)
        • 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
      • かっこを使用する必要がある継承権限のシーケンス:

        • (I) - Inherit. ACE は親コンテナーから継承されます。
        • (OI) - Object inherit. このコンテナー内のオブジェクトは、この ACE を継承します。 ディレクトリにのみ適用されます。
        • (CI) - Container inherit. この親コンテナー内のコンテナーは、この ACE を継承します。 ディレクトリにのみ適用されます。
        • (IO) - Inherit only. ACE は親コンテナーから継承されましたが、オブジェクト自体には適用されません。 ディレクトリにのみ適用されます。
        • (NP) - Don't propagate inherit. ACE は親コンテナーからコンテナーとオブジェクトによって継承されますが、入れ子になったコンテナーには反映されません。 ディレクトリにのみ適用されます。

    Examples

    C:\Windows ディレクトリとそのサブディレクトリ内のすべてのファイルの DACL を ACLFile ファイルに保存するには、次のように入力します。

    icacls c:\windows\* /save aclfile /t
    

    C:\Windows ディレクトリとそのサブディレクトリに存在する ACLFile 内のすべてのファイルの DACL を復元するには、次のように入力します。

    icacls c:\windows\ /restore aclfile
    

    ユーザーに Test1 という名前のファイルに対する DAC の削除および書き込みアクセス許可をユーザーに付与するには、次のように入力します。

    icacls test1 /grant User1:(d,wdac)
    

    SID S-1-1-0 で定義されたユーザーに TestFile という名前のファイルへの DAC の削除と書き込みのアクセス許可を付与するには、次のように入力します。

    icacls TestFile /grant *S-1-1-0:(d,wdac)
    

    To apply a high integrity level to a directory and ensure that both its files and subdirectories inherit this level, type:

    icacls "myDirectory" /setintegritylevel (CI)(OI)H