ITsVISTA
Information that makes life easier when it comes to installing, managing, and using Windows Vista.
Start About FAQ Blogroll Shop

Vista's ICACLS Command

Display, modify, backup, or restore ACLs for files and directories.

ICACLS name /save aclfile [/T] [/C] [/L] [/Q]

  • store the the acls for the all matching names into aclfile for later use with /restore.

ICACLS directory [/substitute SidOld SidNew [...]] /restore aclfile [/C] [/L] [/Q]

  • applies the stored acls to files in directory.

ICACLS name /setowner user [/T] [/C] [/L] [/Q]

  • changes the owner of all matching names.

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 for 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 previouly 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.

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.
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:
    • 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:
    • D - 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

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

Get notified of new posts for FREE via RSS or E-mail

Subscribe to ITsVISTA!

Related Posts

Comments

  • John

    Jun 2, 2007 at 7:50 am

    Good post of the help output. Question I have is can acl modifications be done for Groups as well as individual users?

    Thanks!

  • Joe

    Jun 2, 2007 at 11:21 am

    Yes. You can grant or deny rights based not only on a user or group name but also on a SID.

  • John Poul

    Jun 3, 2007 at 3:02 pm

    Verry god post and hopfully it will help me!
    Question is ,if the permissions has been screewed up for the directory windows or system32.
    Can i use this to restore it to default value?
    The value it had when the system was installed.

  • Joe

    Jun 30, 2007 at 8:48 pm

    I don’t believe there is any automatic way to restore the defaults, you’d have to manually tell it what rights to assign.

  • Jry_AcR

    Nov 2, 2007 at 10:30 am

    Hi I’m a newbie building a .PHP website, everytime i’m trying to test my webpage I received and error saying http 403. not authorized and a problem with the “Acl” in the wwwroot/web.confg. When I tried to open the web.config it gives me an error saying “access denied”. I look at the security on that file and everything sinces ok(on my point of view). samething happens when i open http:/localhost/ using IIS7.
    Sorry for the long explanation, but I will like to reset my ACL on windows vista, how do I manage to do that. or if any body can help me thru the php/mysql installation i really appreciated.

    Note: I have already try to install 4 times now and nothing works :(

  • Fred

    Jan 23, 2008 at 9:28 pm

    Thanks for the post - but it’s just a listing of the Help command-line output from icacls.
    Would you like to explore the command further with some more examples and scenarios?
    So far I’ve found that you can open up files dumped in the Public folder (by a remote administrator, no less) with:
    icacls *.* /grant Manager:f
    That should take care of a few million problems. :)
    For everything it grants Manager full access.
    HTH

    Anyone else care to show and tell?

Leave a Comment