NTFS Permissions and icacls Cheat Sheet

NTFS permissions reference for Windows admins: rights codes, inheritance flags, icacls and takeown syntax, evaluation order and the recipes that fix a broken tree.

Start here

Who has access to this folder?
icacls D:\data
Give a group modify on the whole tree
/grant "DOM\Grp":(OI)(CI)M /T
Permissions are a mess
icacls D:\data /reset /T /C
Access denied even as admin
takeown /F D:\data /R /D Y
Save the ACLs before touching them
icacls D:\data /save acl.txt /T
New files must inherit it
(OI)(CI)
Two questions, always in this order. What rights are granted, and how do they inherit. Most permission problems are the second question, not the first.

Permission sets

CodeGrants
FFull control, including changing permissions and taking ownership
MModify: read, write, delete. The right answer for most shares.
RXRead and execute
RRead only
WWrite only, which alone cannot read back what it wrote
DDelete
NNo access
Granular rightMeaning
RD / WDRead data, list folder / write data, add file
ADAppend data, create subfolder
XExecute, traverse folder
DE / DCDelete / delete child
RA / WARead / write attributes
REA / WEARead / write extended attributes
RCRead the security descriptor
WDAC / WOChange permissions / take ownership

Inheritance flags

FlagMeaning
(OI)Object inherit: files below this folder get it
(CI)Container inherit: subfolders get it
(IO)Inherit only: the folder itself is not covered
(NP)No propagate: one level down only
(I)Shown in output: this entry came from the parent
CombinationApplies to
(OI)(CI)This folder, its subfolders and its files. The normal choice.
(OI)(CI)(IO)Subfolders and files only, not the folder itself
(CI)This folder and subfolders, no files
(OI)This folder and its files, no subfolders
(OI)(CI)(NP)This folder and its immediate children only
no flagThis folder alone. Nothing created later inherits it.
The classic mistake. Granting rights without (OI)(CI) works today and fails tomorrow, because every file created after that point inherits nothing from the entry you added.

icacls

TaskCommand
Show the ACLicacls D:\data
Grant, keeping existing entriesicacls D:\data /grant "DOM\Grp":(OI)(CI)M
Grant, replacing that identity’s entriesicacls D:\data /grant:r "DOM\Grp":(OI)(CI)M
Denyicacls D:\data /deny "DOM\User":(OI)(CI)F
Remove all entries for an identityicacls D:\data /remove "DOM\User" /T /C
Remove only the deny entriesicacls D:\data /remove:d "DOM\User" /T
Reset to whatever the parent saysicacls D:\data /reset /T /C /Q
Disable inheritance, keep a copy of the entriesicacls D:\data /inheritance:d
Re-enable inheritanceicacls D:\data /inheritance:e
Strip inherited entries outrighticacls D:\data /inheritance:r
Change the ownericacls D:\data /setowner "Administrators" /T /C
Back up every ACL in a treeicacls D:\data\* /save C:\temp\acl.txt /T
Restore themicacls D:\ /restore C:\temp\acl.txt
Find an orphaned SIDicacls D:\data /findsid S-1-5-21-1111111111-2222222222-3333333333-1105 /T
Check for broken ACLsicacls D:\data /verify /T
SwitchEffect
/TRecurse into the whole tree
/CContinue after errors instead of stopping
/QQuiet, suppress the success lines
/LAct on the symbolic link itself, not its target
/grant:r is a replace. The colon-r form removes every existing entry for that identity before adding yours. On a live share that is how an entire department loses access in one command. Save the ACLs first.

Ownership and attributes

TaskCommand
Take ownership of one filetakeown /F D:\data\file.txt
Take ownership of a treetakeown /F D:\data /R /D Y
Assign to the Administrators group, not to youtakeown /F D:\data /R /A /D Y
Show attributesattrib D:\data\file.txt
Clear hidden and system on a treeattrib -h -s D:\data\*.* /S /D
Set read-onlyattrib +r D:\data\file.txt
Exclude from content indexingattrib +i D:\data /S /D
Ownership beats permissions. An owner can always rewrite the ACL, which is why takeown followed by icacls /grant is the standard rescue for a folder nobody can open, including one left behind by a deleted account.

Identities you will meet

NameWhat it means
NT AUTHORITY\SYSTEMThe machine itself. Never remove it from system paths.
BUILTIN\AdministratorsLocal administrators, including domain admins on members
BUILTIN\UsersEvery interactive local and domain user on the machine
Authenticated UsersAnyone who authenticated, excluding guests
EveryoneAuthenticated users plus guest access
CREATOR OWNERTemplate: applied to whoever creates the item, inherit-only
NT SERVICE\TrustedInstallerOwner of Windows system files
NT SERVICE\MSSQLSERVERPattern for per-service identities, valid in icacls

How Windows decides

OrderRule
1Explicit deny on the object
2Explicit allow on the object
3Inherited deny from the nearest parent
4Inherited allow from the nearest parent
5Nothing matched, access is refused
SituationResult
User is in two groups, one allows, one deniesDeny wins at the same level
Explicit allow on the file, inherited deny on the folderThe explicit allow wins
Share permission Read, NTFS ModifyRead, the more restrictive of the two
Rights changed while the user is connectedKerberos ticket still carries the old groups, log off and back on
Deny is a last resort. An explicit deny outranks every allow at the same level and is invisible when you skim an ACL. Remove the account from the group instead.

Recipes

TaskCommand
Standard department shareicacls D:\share /grant "DOM\Dept-RW":(OI)(CI)M /grant "DOM\Dept-RO":(OI)(CI)RX /T
Rescue a folder nobody can opentakeown /F D:\stuck /R /A /D Y then icacls D:\stuck /grant Administrators:(OI)(CI)F /T /C
Snapshot before a changeicacls D:\share\* /save C:\temp\acl-before.txt /T
Roll that change backicacls D:\ /restore C:\temp\acl-before.txt
Purge a leaver from every foldericacls D:\share /remove "DOM\leaver" /T /C /Q
Clean up orphaned SIDs after a migrationicacls D:\share /findsid S-1-5-21-... /T
Break inheritance for one project foldericacls D:\share\secret /inheritance:d then /remove what should not be there
Rebuild a tree that was reset by handicacls D:\share /reset /T /C /Q
Users own what they createicacls D:\drop /grant "CREATOR OWNER":(OI)(CI)(IO)M

FAQ

I am a domain admin and still get access denied. Why?
Administrative rights are not a bypass on NTFS. If the ACL has no entry for you, you get nothing until you take ownership or use backup privilege. Start an elevated console, then takeown followed by an icacls /grant. On a UAC-filtered token the same command fails silently in a non-elevated window.
Everything worked, then new files stopped inheriting the rights.
The entry was added without (OI)(CI), so it applies only to the folder object itself. Re-grant with the inheritance flags, then run the same command with /T so existing children pick it up.
Does icacls /reset delete my permissions?
It replaces the ACL with whatever the parent would give the object. On a folder that deliberately breaks inheritance that is destructive, and there is no undo beyond a saved ACL file or a backup.
Share permissions or NTFS permissions?
Set the share to Authenticated Users Full Control and do all the real work in NTFS. Two overlapping permission models on one folder is how a “why can they read this” ticket turns into an afternoon.
Is cacls still usable?
It exists for compatibility and it mangles inheritance. Use icacls for anything you care about, and PowerShell’s Get-Acl and Set-Acl when the logic gets complex enough to need objects.