Couple folders went 'access denied' in Windows. Why and how to fix?

2

So, after a failed Windows 7 install, I put XP back on, and had a adrenaline shot when I got an access denied on a couple of my backed up folders. I already tried the instructions here at Microsoft KB, but it didn't fix it. I did add myself with full permissions on the main section of the Security tab, though, and that gave me access into the folder (I could do it in XP Home because of the Windows NT SP4 Security Configuration Manager). However, it appears some subfolders are still inaccessible.

Two questions, then. Why exactly did this happen and how do I fix it?

Nathaniel

Posted 2009-12-19T23:58:54.443

Reputation: 3 966

FYI, I'll be leaving on a trip Tuesday, and I'll probably be on Super User, but I intend to fix this (see my latest comment on John T's answer) before I leave. Therefore, I won't be able to test any suggestions on this case anymore, because it will no longer exist. That being said, I will probably check this question tomorrow morning (PST) before I fix it. – Nathaniel – 2009-12-21T02:38:38.193

Answers

3

Why did it happen?

The user account associated with the permissions isn't the one trying to access them. The folders were probably backed up to an NTFS drive, which kept the permissions intact.

You can try using cacls to take ownership of the files recursively from the command line:

cacls "C:\path\to\folder" /E /T /C /G "Administrator":F

Explanation of the switches:

/E - this edits the access control list currently in place, instead of 
replacing it

/T - this allows it to function recursively

/C - this will continue on access denied errors

/G - this grants the user you specify the access rights you specify in
the form of user:permissions. R = Read, W = Write, C = Change, 
F = Full control.

Replace C:\path\to\folder with the location of the folder giving you problems. This will look inside that folder recursively and try to change access permissions on everything inside it. Replace Administrator with the administrative account you are taking ownership with.

John T

Posted 2009-12-19T23:58:54.443

Reputation: 149 037

So... the accepted answer did not actually help? – foraidt – 2010-03-30T05:58:38.107

@mxp, if you read the comments, you'll see he used my suggestion from one of the comments to solve the problem. HTH. – John T – 2010-03-30T16:50:12.793

@John T Yes, I noticed that. I think it would be a good idea to edit your answer so it contains the real answer and one doesn't have to dig through the comments to find out what really solved the problem. – foraidt – 2010-03-30T18:29:50.823

@mxp it is not essentially the real answer, as my initial answer would work in most cases. Nathaniel's situation is somewhat unique. I can add it to my original answer if it is really bugging you. – John T – 2010-03-30T22:13:11.993

Ah. Handy. Seems to check with what I've been reading. Might want to edit the answer to explain what the switches do: http://ss64.com/nt/cacls.html

– Nathaniel – 2009-12-20T00:12:16.867

My pleasure! :) – John T – 2009-12-20T00:14:05.553

Hum. I just tried it and got a bunch of ACCESS_DENIEDs. Any ideas? – Nathaniel – 2009-12-20T00:15:48.247

It shouldn't have with the /C switch :P are you using an administrator account? – John T – 2009-12-20T00:19:21.037

Yes, new XP install. But I haven't added a password to the account yet. Would that make a difference? – Nathaniel – 2009-12-20T00:21:21.287

Wouldn't hurt to find out :) – John T – 2009-12-20T00:22:41.520

OK, tried it. Same thing. :( – Nathaniel – 2009-12-20T00:29:10.563

Hmm. Linux doesn't respect NTFS permissions, you could try accessing them with a LiveCD such as Ubuntu ( http://www.ubuntu.com/ ). Were the files encrypted?

– John T – 2009-12-20T00:32:05.353

Already done that with my 9.04 LiveCD. I can get the files fine from Linux and now somewhat from Windows because of my messing. I'm sort of just trying to reset the permissions. I don't like 'em screwed up. – Nathaniel – 2009-12-20T00:58:53.217

If you have a flash drive, format it as FAT32 and copy the files to it (ensure none are 4GB+ though). Remove the files from the drive (to ensure the permissions are removed from the MFT), them copy them back over. They should have no permissions set and you can take ownership of them. – John T – 2009-12-20T01:09:06.117

Ok. I think I'll probably just use Linux to copy them to my local drive, delete the external copy, and then copy it to external again. A bit time consuming, but I want this fixed before we leave on a trip on Tuesday. – Nathaniel – 2009-12-21T02:36:17.963