Sunday, September 5, 2010

Fixing Permissions on an External Hard Drive

Today I pulled a hard drive from my old computer and hooked it up to my new computer, planning to move the data to the new drive and then use the old drive as a backup disk. Mostly this plan worked well, except that I wasn't allowed to delete many files and folders, even though I was an Administrator. Curious.

The problem turned out to be that I was on a workgroup, not a domain, and so the systems didn't have any common notion of "Administrator". Although Explorer knows how to request elevated permissions, this still isn't enough. You have to "Take Ownership" of the files in order to delete them, and there's no way to do this from Explorer.

I found a solution in the winmatrix forum, but it only works for files, not directories. You can't set the Full Control permission on a directory, so you end up being locked out of directories if you try and use these commands:

takeown /f filepath /r
icacls filepath /grant yourusername:f /t


(I've added /r and /t to the commands, which is required for the them to operate recursively.)

Instead, I did the steps below. These steps assume that the new drive is on E:.
  1. Open a Command Prompt with Run As Administrator.
  2. Run this command: takeown /f e:\ /r
  3. Right-Click on the root of the copied drive.
  4. Select Properties.
  5. Click the Security tab.
  6. Click the Edit button.
  7. Select Authenticated Users.
  8. Click the checkbox under Allow for Full Control.
  9. Run this command: icacls e:\*.* /reset /t
    This command will force all permissions to mirror the permissions on the root of the drive that you set in #6. You must have the *.* or the root directory will be reset, which you don't want.
After these commands completed, I was able to delete all of the desired files. Executing these commands can take quite a while if you have many files on your disk.

46 comments:

  1. thanx, worked well

    ReplyDelete
  2. Thankyou SO much. I'd just set up a new system and needed to resolve a external HDD permission issue. After hours of searching this done it.

    ReplyDelete
  3. I wasn't looking for deletion of the files but for discovery by Windows 8, this helped me out by resetting all of the mess I created changing permissions, now my problem is resolved!!!

    ReplyDelete
  4. Worked like a charm, thanks you.

    ReplyDelete
  5. thanks thanks thanks! had screwed up permissions on ext. drive connected to wndr3700 router after trying to set certain folders for access by friends on the 'net...d'OH!
    this worked for me, too!!!
    once more--thanks!

    ReplyDelete
  6. It worked unlike everything made by Microsoft......PERFECTLY.
    Thank you SO much. Major help and prevented more down time from a bad registry from an OS I had to re-install which is why I needed to move files from an HDD. I'm bookmarking your site for the future.

    ReplyDelete
  7. woooaaaahhh,...... thank you soooo much... :) cheers.....

    ReplyDelete
  8. Rock On !! That worked for me :)

    ReplyDelete
  9. It works for me. You safe my day. I like you bro =)

    ReplyDelete
  10. Thanks for taking the time... all done and working o.k

    ReplyDelete
  11. THANK YOU!!!!!! You saved me 2.2 TB worth of files

    ReplyDelete
  12. How can I go about making my external hdd accessible to any computer I plug it in to and how do I make that permanent? I'd hate to have to do this every time I plug it in somewhere.

    ReplyDelete
    Replies
    1. In my example code, instead of "yourusername", use "Everyone". I believe that works across computers.

      Delete
  13. Worked exactly as described. Thanks!

    ReplyDelete
  14. Thanks! I tried everything and just messed things up worse. Your how to saved my bacon

    ReplyDelete
  15. no doubt, this is perfectly worked for me !

    thank you :)

    ReplyDelete
  16. i love you. i wish i found this 9 hours ago.

    ReplyDelete
  17. Jim, I hope you don't mind, but I'm sending you a big kiss! :-)*

    ReplyDelete
  18. Fantastic, this is definitely the fix! Thanks for posting.

    ReplyDelete
  19. After four days of trying to get control of my files some that date back to the 1940s and paying avast to get me access to the partition that used to be C:\ now D:\through some magical efforts but still not bootable your command line got the files released from the permissions monster I am copying everything to an external drive formatting the harddrive and returning the files back to the new C:\ reinstalling win 10 or going to try to repair win 10 first I did not reset the permissions so there was no confusion between the temporary win 7 setup and the win 10 existing setup this is the meanest nastiest virus/malware/trojan I've ever seen its heartless I type this as I pray for a lifetime of memories not to be lost. THANKYOU so much. STEPHEN NORMYLE

    ReplyDelete
  20. Worked great on non system files but when it came to them Not so well if like to know if there is a command ie like the command
    "takedown /f D:\ /r"
    That is the command I used on a fixed disk to recover a corrupted ownership I didnot reset permissions because the job was not complete ..any help will be greatly appreciated

    ReplyDelete
  21. for me didnt worked cus now i need my own permission..lol how...no clue.

    ReplyDelete
  22. Thank you very much, that's what I was looking for since few days!

    ReplyDelete
  23. Thank you so much - this was a life-saver!

    ReplyDelete
  24. this is awesome.. thank you

    ReplyDelete
  25. Is there perhaps an update this helpful article? It's 2019 and I followed the steps to the letter in Win 10 on an External 8TB Seagate drive and still a bunch files on that drive refuse to be copied to another location. By now EVERY imaginable user on my PC has FULL rights to these files. Still no go. Those a family picture so I must keep multiple copies, quite distressed over this. Tried accessing the same files via Linux (USB boot) and the permissions hold! I am at my wits ends..

    ReplyDelete
  26. It worked...... wow🤸‍♂️ so happy thanks

    ReplyDelete
  27. Can not get my laptop to work.it says group profile access is denied

    ReplyDelete
  28. Can not get my laptop to work.it says group profile access is denied

    ReplyDelete
  29. If icacls encounters an error it quits unless you add /c. If it quits in the middle of resetting 1,000,000+ files on a large drive, you end up wasting a lot of time because there's no way to restart in the middle. The command should be

    icacls e:\*.* /reset /t /c >icacls.log 2>&1

    This also saves the output to a file, which you can then examine after the command completes, to find any errors.

    ReplyDelete
  30. Oh man! Thanks a lot. You just have saved my life.

    ReplyDelete
  31. Thank you! this is very helpful

    ReplyDelete
  32. An old post but thank goodness it was still around! I have been looking for a solution for a week. I rejuvenated an 8 year old WIN7 PC with a 2nd drive (E:) that was dedicated to music on my homegroup network. When I wiped the C: and reinstalled a clean copy of Win10, E: did not like that I left it out, and decided that it wouldn't allow me access. Your fix worked - thanks very much!

    ReplyDelete
  33. Still working like a charm for windows 10.. Thank you for this post..

    ReplyDelete
  34. My issue is with a NAS mapped drive. "takeown" brings up error "file ownership cannot be applied on insecure file systems; there is no support for ACL's" - whatever that means.
    No security tab in properties and yet another mapped drive has the tab.

    ReplyDelete
  35. Apparently, I'm an idiot! This did not work for me. Both me and my wife have gotten new computers (Dell with Windows 10 Pro). And new external harddrives as well. I had no issues with getting my files from old drive to new. But with my wife, everything except one folder copied with no problem. I can access the folder and see all the files and filenames. But cannot modify any of them or move them. Any other help would be greatly appreciated! Thanks!

    ReplyDelete