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?

3
  • 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... Jun 26, 2009 at 21:43
  • Yep, I wouldn't be asking if something wasn't very wrong :)
    – Jim Counts
    Jun 26, 2009 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.
    – user146986
    Nov 26, 2012 at 7:48

8 Answers 8

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.

6
  • 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, 2009 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. Jan 31, 2011 at 10:55
  • I'm an idiot; I can't believe I didn't think to check this. Thank you. Jan 11, 2012 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, 2013 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, 2015 at 8:55
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.
1
  • Using Process Explorer to locate the process holding the folder is an excellent idea
    – KalenGi
    Jul 23, 2022 at 14:19
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.

1
  • +1 Thanks for the suggestion, I've used Unlocker before but in this case I wanted to avoid installing anything.
    – Jim Counts
    Jun 26, 2009 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.

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 4, 2017 at 5:47
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!

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .