Not adding the :r, means that permissions are added to any previously granted explicit permissions.
[/deny <sid>:<perm>[...]]
Explicitly denies 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>[...] [/t] [/c] [/l] [/q]
Removes all occurrences of the specified SID from the DACL. This command can also use:
:g - Removes all occurrences of granted rights to the specified SID.
:d - Removes all occurrences of denied rights to the specified SID.
Explicitly adds an integrity ACE to all matching files. The level can be specified as:
l - Low
m- Medium
h - High
Inheritance options for the integrity ACE may precede the level and are applied only to directories.
[/substitute <sidold><sidnew> [...]]
Replaces an existing SID (sidold) with a new SID (sidnew). Requires using with the <directory> parameter.
/restore <ACLfile> [/c] [/l] [/q]
Applies stored DACLs from <ACLfile> to files in the specified directory. Requires using with the <directory> parameter.
/inheritancelevel: [e | d | r]
Sets the inheritance level, which can be:
e - Enables inheritance
d - Disables inheritance and copies the ACEs
r - Disables inheritance and removes only inherited ACEs
Remarks
SIDs may be in either numerical or friendly name form. If you use a numerical form, affix the wildcard character * to the beginning of the SID.
This command preserves the canonical order of ACE entries as:
Explicit denials
Explicit grants
Inherited denials
Inherited grants
The <perm> option is a permission mask that can be specified in one of the following forms:
A sequence of simple rights (basic permissions):
F - Full access
M- Modify access
RX - Read and execute access
R - Read-only access
W - Write-only access
A comma-separated list in parenthesis of specific rights (advanced permissions):
D - 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
Inheritance rights may precede either <perm> form:
(I) - Inherit. ACE inherited from the parent container.
(OI) - Object inherit. Objects in this container will inherit this ACE. Applies only to directories.
(CI) - Container inherit. Containers in this parent container will inherit this ACE. Applies only to directories.
(IO) - Inherit only. ACE inherited from the parent container, but does not apply to the object itself. Applies only to directories.
(NP) - Do not propagate inherit. ACE inherited by containers and objects from the parent container, but does not propagate to nested containers. Applies only to directories.
Examples
To save the DACLs for all files in the C:\Windows directory and its subdirectories to the ACLFile file, type:
icacls c:\windows\* /save aclfile /t
To restore the DACLs for every file within ACLFile that exists in the C:\Windows directory and its subdirectories, type:
icacls c:\windows\ /restore aclfile
To grant the user User1 Delete and Write DAC permissions to a file named Test1, type:
icacls test1 /grant User1:(d,wdac)
To grant the user defined by SID S-1-1-0 Delete and Write DAC permissions to a file, named Test2, type:
Συμμετάσχετε στην απόλυτη εικονική εκδήλωση του Windows Server από 29 έως 30 Απριλίου για τεχνικές συνεδρίες βαθιάς ανάλυσης και ζωντανές ερωτήσεις και απαντήσεις με μηχανικούς της Microsoft.