Tuesday, May 16, 2017

windows 7 - Can't take ownership of files



On my data drive I have roughly 800 files for which I have only read and execute permissions, but no others.




When trying to change the permissions via Windows Explorer, all fields relating to changing permissions are greyed out. When running...



icacls FILE /grant UserName:F


...in CMD, I get the error FILE: Access denied.



Note that these behaviours apply even when activating the logging into the hidden administrator account (net user administrator /active:yes) in Safe Mode.




Upon detailed inspection I have found that the files allow full permissions to a user from an installation that no longer exists. The other listed users ("Jeder", German for "Everyone", and one other non-existing user) have only read/execute permissions.



screenshot of User Permissions window in German



Is there some solution short of moving the whole drive to an external drive and formatting the current drive? With more than 50,000 files on this drive, doing so would be rather time-consuming, especially since this seems to be a recurring problem.



EDIT: The /reset option to icacls doesn't work either.



EDIT: For further readers: For me for files where changing permissions failed, takeown /f FILE worked, see Tetsujin's answer and its comments.


Answer




Essentially, you need to take ownership of some of them yourself, but give ownership to TrustedInstaller for others. If you're not sure which should be which, then it might be best to let a tool do it for you...



I've used the tweaking.com tools to successfully recover mashed system perms before, including when someone 'cleverly' managed to remove TrustedInstaller as owner of half the system & took ownership of everything they could find.



You could, to be honest, do the same yourself from the command-line, but frankly unless you have a very pedantic setup, it's simpler to set things back to Windows' defaults.



Try the all-in-one tool or one of the more specific tweakers if you know exactly where you're heading...



They also have some very good notes on how to boot into the cleanest possible setup so the tools can do their job - clean boot




For non-system files, taking ownership is probably easiest, & you shouldn't need TrustedInstaller if they're all non-system files



On an elevated command prompt, use takeown /F to force ownership of files.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...