cacls "C:\path\to\your\file.txt" /E /D "NT AUTHORITY\SYSTEM":W No mapping between…
- User
cacls "C:\path\to\your\file.txt" /E /D "NT AUTHORITY\SYSTEM":W No mapping between account names and security IDs was done.
Assistant
The error:
No mapping between account names and security IDs was done.means that Windows could not resolve the account name you provided — in this case,
"NT AUTHORITY\SYSTEM"— to a valid Security Identifier (SID). This usually happens due to one of the following reasons:
✅ Root Causes & Fixes
1. ❌ You're using
cacls, which does not supportNT AUTHORITY\SYSTEMdirectlycaclsis a very old tool and does not recognizeNT AUTHORITY\SYSTEMas a valid user name. It only supports basic users and groups likeEveryone,Administrators, or a username likeDOMAIN\user.👉 Solution: Use
icaclsinstead, which does supportNT AUTHORITY\SYSTEM.
✅ Correct Command Using
icacls:icacls "C:\path\to\your\file.txt" /deny "NT AUTHORITY\SYSTEM":(OI)(CI)(WD,AD,WEA,WA)Explanation of Permissions:
Permission Meaning WDWrite Data ADAppend Data WEAWrite Extended Attributes WAWrite Attributes These are the equivalents of:
FILE_WRITE_DATAFILE_APPEND_DATAFILE_WRITE_EAFILE_WRITE_ATTRIBUTES
2. 🧪 If you're unsure whether the user/group exists, check with:
Use
whoami /groupsornet userto test local/remote usersBut better yet, to verify if
NT AUTHORITY\SYSTEMis recognized:whoami /allOr:
net user "NT AUTHORITY\SYSTEM"❗ That
net usercommand will fail, becauseSYSTEMis not a user account but a well-known security principal, andnet useronly works for local or domain user accounts.✅ But
icaclsdoes recognizeNT AUTHORITY\SYSTEM, so just use it.
3. 🛠️ Alternative: Use SID (Not recommended unless necessary)
You can also use the SID for
SYSTEM(S-1-5-18) withicacls, but this is not recommended unless scripting in automation environments where the name is not available.icacls "C:\path\to\your\file.txt" /deny *S-1-5-18:(OI)(CI)(WD,AD,WEA,WA)⚠️ Again, this is not needed in most cases. Stick with the friendly name
NT AUTHORITY\SYSTEMinicacls.
✅ Final Recommendation
Use
icaclslike this:icacls "C:\path\to\your\file.txt" /deny "NT AUTHORITY\SYSTEM":(OI)(CI)(WD,AD,WEA,WA)This will:
- Deny write access to SYSTEM
- Apply to both files and subfolders
- Preserve existing permissions (
/denydoes not overwrite ACLs)
If you still want to use
cacls, you must restrict yourself to local users/groups likeEveryone,Administrators, or a real user account, but notSYSTEM.Let me know if you'd like help generating a full script to apply this recursively to a folder tree.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.