21

I have a Windows 2003 Standard x64 Server with SP2.

After deleting a large number of folders from a folder, the OS is reporting "Access Denied" on any attempt to read or manipulate the folder. When examining the folder's properties, the Security tab is missing, only General and Customize are listed. We've tried a few things already.

  1. Rename folder, access denied.
  2. Delete folder, access denied.
  3. Take ownership of parent folder, and propagate permissions to children, access denied.
  4. Subinacl, access denied.
  5. Takeown (cmdline), access denied.

We are running chkdsk in read-only mode, and this has not completed yet. If possible we would like to solve this problem without rebooting or running a full chkdsk with the server offline.

Does anyone know a solution to this problem?

Jim Counts
  • 337
  • 2
  • 4
  • 10
  • If you can't claim ownership, and your account is a domain admin or enterprise admin account, then something is /very/ wrong with this picture... – Avery Payne Jun 26 '09 at 21:43
  • Yep, I wouldn't be asking if something wasn't very wrong :) – Jim Counts Jun 26 '09 at 22:12
  • 1
    I found that the above was correct. A user was holding the folder open, with a hung process. I used a tool called Hyena and disconnected the users session from the folder in question and this allowed me access. –  Nov 26 '12 at 07:48

8 Answers8

36

When I've seen this it was because a process was holding the folder open but the folder was in the process of being deleted. Use a tool like Process Explorer to see if anything has an open handle on the folder. I would guess that once you release it or reboot, that folder will disappear.

Kevin Kuphal
  • 9,064
  • 1
  • 34
  • 41
  • 1
    Thanks, I found that System had a handle. When I deleted the handle, the folder vanished. It was empty anyway, so +1 for the win. – Jim Counts Jun 26 '09 at 21:46
  • Worked fine for me too. Had the index service on the server cidaemon locking one file and preventing profile loading on the client. – André Schild Jan 31 '11 at 10:55
  • I'm an idiot; I can't believe I didn't think to check this. Thank you. – Owen Blacker Jan 11 '12 at 12:15
  • 3
    Thanks, this worked for me. It should be noted that the messages given in this case are misleading. Why don't you get the "this is being used by a program" instead of "access denied" when you try to delete or take ownership? – harpo Aug 16 '13 at 17:41
  • Similar situation here: gimp owned a folder handle and svn clashed trying to remove it when switching to another branch. Lost more than an hour looking why I can't do anything to the folder, including tweaking with user permissions, trying takeown, icacls, subinacl etc. It would be great if a message could be more correct - about file being used and delete pending, not only "access denied". – Zbyszek Jan 20 '15 at 08:55
  • I'm having a very similar problem with a sub-directory on a network share. No access at all and no lock from either user or application; Process Explorer found nothing. So far, no solution :( – Rich M May 02 '19 at 10:52
2

To delete files / folder locked by the system.

  1. Locate the folder c:\users\xxx
  2. Try to take ownership of the folder and subfolder : (it will probably failed)
  3. If not failing, give you full rights to the folders and subfolder and delete it.
  4. But since it’s failing, we need to find witch windows process lock the files.
  5. Start c:\cms\Microsoft SysInternal\procexp.exe
  6. Go to find, find handle
  7. Do a search c:\users\xxx
  8. Take not of the PID number that is locking the files (second column)
  9. Go back and Kill process or Kill process tree if it’s a tree.
  10. Go back to the folder and take the owner ship of the folder and subfolder c:\users\xxxx
  11. Give you full rights of the folder and subfolder c:\users\xxx
  12. Delete the c:\users\xxx folder
  13. Log back the user, he will have a fresh new profiles.

How to take owner ship and give you full rights of a folders and subfolders

  1. Locate your c:\users\xxx folder
  2. Right mouse on it | properties | Security | Advanced | Owner | Edit | Choose your ad account | Replace Owner on subcontainers and objects | Apply
  3. Go back to Permissions tab | change permissions | add your ad account | Full control | Replace all child object permissions with inheritable permissions from this object
  4. Now delete your c:\users\xxx folder.
Rex
  • 7,815
  • 3
  • 28
  • 44
user283191
  • 21
  • 1
1

I'd tried most of the above after an annoying file causing fault on backups each night this week. Stumbled on this and tried a few extra things but still couldn't find what was locking it mind.

If it helps anyone else, in this case there was a ".TMP" file in a shared folder. One user had an excel sheet in the folder open, another just had the folder itself open. Nothing would allow access to this TMP file.

Closing the connection for that user did not work as it came back straight away.

Remotely looking at the user computer who was away but had left this folder open in explorer I saw they had explorer set to show preview pane and it had an Excel file highlighted in that folder showing a preview. Turned off preview and close the window and file deletable from the server.

Good old Windows, there was no record in process explorer, computer management, openfiles etc. of this file at all!

1

It sounds more like there is a file lock on the folder - probably some application has got it open. Try using a program like Unlocker - it should show you what app has got it locked and it can release the lock and then delete the file or folder for you.

Sanjay Sheth
  • 194
  • 3
  • +1 Thanks for the suggestion, I've used Unlocker before but in this case I wanted to avoid installing anything. – Jim Counts Jun 26 '09 at 22:11
1

I had this same issue, and as in Kevin's situation, the file was being held open which it was being deleted. However, there was nothing in process explorer, unlocker failed, as did numerous other things I tried.

Turns out because the folder was shared it was being held open by another user and can be solved by going to Administrative Tools -> Computer Management -> Shared Folders -> Open Files and closing the relevant files or folders from in there. The folders then finished deleting automatically.

Nick
  • 11
  • 1
  • Wow, 3.5 years later on, this really saved my day. Thank you. The file remained opened in there through a computer shutdown and restart. After clearing it there, I deleted it easily. – Noam Gal Dec 04 '17 at 05:47
0

I was in an identical situation - the backup/restore program we use (FDR/Upstream) had a lock on the folders - restarted it's service and it let go.

0

Something similar happened to me. I had a process locking the file. This is how I fixed it. I downloaded Process Explorer from Run now from Sysinternals Live. Then on the menu bar at the top of the application, I clicked Find. There I typed the file or directory I couldn't change permissions. This process may take awhile. Once the file or directory comes up, I found the process that holds the lock. Then I right clicked the process and killed it.

-2

I had this same problem and the only way I realized why I couldn't take ownership or even grant permissions was by using Process Explorer. It told me that AVG, my anti-virus, had a grasp on my entire E:\ Drive. Disabled the anti-virus, and voila! It works! Time to uninstall this trash.