How to fix "No access" error when changing Windows file permissions
By Robin Smidsrød on Dec 10, 2011 | In Software, Hardware
Yesterday I helped my father to install his new computer with Windows 7. For several reasons I shall not mention, it was in the best interest to take the hard drive of the old (broken) computer and copy all the data from it to the new. What he (and me) wanted was to keep all the settings and other stuff and just reinstall his programs. That meant copying the entire AppData folder under his user account in addition to his normal files.
During this process obviously all files had kept the old SIDs, and as they weren't matching his new SID (on the new computer) I was having problems accessing the files. Lots of stuff didn't work. I was getting "No access" messages left and right when I tried to change the permissions of those copied files. That is when it dawned on me that even though his user account was registered as an administrator, it wasn't able to change the permission bits on those files.
To avoid having to mess around forever to reset permissions to default inherited ACL on all those files (around 30000 or so of them) I dug a bit around on the Internet and found out that there is a command in Windows 7 called icacls.exe that works very much in the same way as chmod on Linux, just that it supports NTFS ACLs.
After reading around I found a forum post that mentioned it, and was redirected to Microsoft's knowledge base article on icacls.exe. After looking over that one I found this command line that solved everything.
cd C:\Users\username
icacls * /reset /T
The /T switch makes it run recursively. /reset, as the KB article explains, replaces the ACL on each file and folder with the default inherited ACL that just uses the ACL on the parent folder.
The last thing that was required was to run this command inside a cmd.exe shell with elevated privileges. You can do that by finding the Command Prompt icon in your start menu and right-clicking "Run as administrator".
Be aware that mucking around with ACLs, if you don't know what you're doing, can seriously break your system in more ways than you can think of. It can also open you up to various attacks because of more relaxed permissions.
If you like what you just read, please subscribe to the feed or follow me on Twitter or any of the other networks I'm registered in to be updated when I post something new.
2 comments
This solved exactly the problem you mentioned. Not only were those files unopen-able for me but I also suspect they weren't being indexed or included in file search results.
You might want to juice up you key words or whatever it is that makes this page show up in search results. I had to do a bit of digging to find your solution. i.e. I had to find and search the Windows command before you turned up.
Anyway, fixed things for me.
Cheers
@Drew: What did you search for when you didn't find it, compared to what you searched for when you did? That would be very useful in improving the keywords.I'm happy that it solved your problem. I banged my head against the wall for several hours myself before I figured it out, while I recovered the computer of a relative.
Leave a comment
| « Solved: ASUS P8Z68-V PRO GEN3 mainboard resetting instead of booting first device | Config::Role - Object constructor parameters from file made easy » |



