In one of your articles on recovering files after a hard disk crash you stated: “Another alternative is to take the old drive and place it into an external USB enclosure, …”
I’ve done that – even though all my old files are on the HD, I can’t access them due to Windows file permissions. Is there a simplistic command I can execute to change all file permissions on the ext hard drive so I can finally access them? Thanks in advance for your time and response.
Yes, there are a couple of approaches. I’ll touch briefly on the Windows GUI approach, but then I’ll show you how I really do it, using the Windows Command Prompt.
In recent versions Windows has apparently tightened some of the file-level security so that frequently when sharing hard drives and removable media across machines this scenario comes up more often than just when recovering files from a damaged hard drive.
Become a Patron of Ask Leo! and go ad-free!
Summary
Windows Gui
- Folder properties, Security tab
- Edit permissions
- Give “Everyone”, “Full Control” access
Command Prompt
- CD folder
- takeown /F * /R
- icacls * /grant:r everyone:f /t
Using the Windows GUI
The “Windows Way” is to locate the folder in Windows File Explorer, right click on the folder containing the files you want to access, and click on properties. That’ll take you to the properties dialog:
(In the example above I right clicked on a folder called “drivers” to get this dialog.)
If you’re having problems, it’s not uncommon to find odd entries in the “Groups or user names” field. Those are typically the id numbers of users or groups from the machine on which the drive was originally installed on. It’s those users or groups that have permission, not you. That’s often where recovery efforts are stymied.
So we’ll open up permissions.
Click the Edit button – note that it has the shield icon indicating that Administrative access is required – you must be administrator and depending on your UAC settings you may be prompted after clicking.
On the next dialog press “Add”, and you’ll be presented with something like this:
In this example, I’m taking the sledgehammer approach and have typed in “Everyone” – click Check Names and it’ll become underlined indicating that it’s valid.
I choose “Everyone” in these examples because, in my case, I control who has access to my machines and my network. Particularly in data recovery operations, it’s also simpler to just make everything accessible to, literally, everyone. In this case “Everyone” is every account that can login to my machine, including all users and if enabled, the Guest account. In a mixed environment where you have less control over the accounts that might be attempting to access your machine you might consider selecting a different account or group such as Administrators to get permissions.
Click OK and you’ll be returned to the Permissions dialog. Click on “Everyone“, and then click on the “Full Control” checkbox below:
Click on OK. If it asks if permissions should be assigned to all files and subfolders, say yes.
You should now be able to access the files.
Now, that’s not what I do.
I’m a command-line kinda guy, and thus I use the Windows Command Prompt.
The first step is to get one with Administrative privileges. Typically, that means you can right click on the icon and click on Run as administrator. If the icon is in your Windows 7 Taskbar, right click on it, then right click on the Command Prompt in the popup menu that appears to get the option:
Now you have a Windows Command Prompt with full administrative access.
“CD” to the location of the folder who’s contents you want to access. In my example, case that’s (keystrokes shown in blue):
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:Windowssystem32>cd /d c:dell
c:dell>
There are two commands that are extremely useful in this scenario; often either one alone is sufficient, but both pretty much guarantee access:
The “takeown” command shown above takes ownership of the named folder, or in this case “/F *” means all files and folders in the current folder. Ownership is assigned to the account you are currently logged in as.
“/R” means to also recurse into any folders and keep assigning ownership to everything found in any and all subfolders. You’ll see a long list of “SUCCESS” messages as ownership is reassigned.
“takeown /?” will display a full list of options.
The other approach is to use a more complicated program called “icacls”. Icacls is a command line utility for managing access control lists – i.e. file access permissions. It has plethora of options that are fairly confusing.
Here’s what I use:
processed file: drivers
…
Successfully processed 66 files; Failed processing 0 files
Once again “*” means all the files and folders in the current folder, “/grant” means we’re granting permissions, “:r” means we’re replacing any existing permissions, “everyone” means that everyone gets the permission we’re about to grant, “:f” indicates that we’re granting full control, and finally “/t” means to perform the operation on all subfolders as well.
“icacls” without any arguments at all will print the lengthy list of things you can do with it.
ICacls should be used with caution. It’s very easy to accidentally remove or assign permissions that boil down to no permission at all. If you do that to the wrong files or folders you could cause some serious problems.
Caveat: I’ll reiterate that I’ve used “Everyone” in the examples throughout this article because nine times out of ten it really is a fine thing to do – quick and easy access to files that you’re attempting to access from some kind of media that’s been transferred from another machine. However, depending on your situation you may want to choose another account or group if you have other login accounts on your machine, or other machines on your local network that might gain access via networked shares.
And a final note: everything here applies to drives that are formatted with the NTFS file system. This level of permission and ownership does not exist on drives formatted as FAT and thus none of this applies. (FAT file systems are the equivalent of “everyone has full access” by default.) But then you also shouldn’t have had any problems accessing the files in the first place.
Leo, do you have a similar process for XP Home platform?
I’ve never been able to resolve my HPFUD50.dll file issue, and therefore can’t update. If I could delete that file, I could update my machine.
Best,
Dell
I found a .REG file that creates a shell command to automatically grant full rights to a file or folder. See below. It’s been very useful and, I hope, not dangerous.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT*shellrunas]
@=”Grant Admin Full Control”
“NoWorkingDirectory”=””
[HKEY_CLASSES_ROOT*shellrunascommand]
@=”cmd.exe /c takeown /f “%1” && icacls “%1″ /grant administrators:F”
“IsolatedCommand”=”cmd.exe /c takeown /f “%1” && icacls “%1″ /grant administrators:F”
[HKEY_CLASSES_ROOTexefileshellrunas2]
@=”Grant Admin Full Control”
“NoWorkingDirectory”=””
[HKEY_CLASSES_ROOTexefileshellrunas2command]
@=”cmd.exe /c takeown /f “%1” && icacls “%1″ /grant administrators:F”
“IsolatedCommand”=”cmd.exe /c takeown /f “%1” && icacls “%1″ /grant administrators:F”
[HKEY_CLASSES_ROOTDirectoryshellrunas]
@=”Grant Admin Full Control”
“NoWorkingDirectory”=””
[HKEY_CLASSES_ROOTDirectoryshellrunascommand]
@=”cmd.exe /c takeown /f “%1” /r /d y && icacls “%1″ /grant administrators:F /t”
“IsolatedCommand”=”cmd.exe /c takeown /f “%1” /r /d y && icacls “%1″ /grant administrators:F /t”
cacls * /e /g everyone:f
/e says to edit the existing permissions instead of replacing them (less likely to cause problems)
/g grants permissions
everyone:f grants full access to everyone
cacls has been deprecated in Windows 7
I can not access my hdd properties folder it told me access denied.
I place in HKEY_LOCAL_MACHIN
SYSTEM
CONTROL SET 001
Pls type syntex.
you wrote, “cacls has been deprecated in Windows 7.”
Oh? That’s news to me. So, what command has replaced it?
Actually the easiest solution is to just ditch the source of the problem – Windows.
Leave the hard disk in the pc and boot from a Linux live-cd – in there you can access all your files without the fear of infecting another pc.
My office computer has an admin control. The power option has been set for ‘turn off in 20 mins’ if I tried to change to ‘never’ but it says access is denied. It is win XP. All settings are denied. How can I stop shutting off every 20 mins. Thanks
I am the only user of my computer. I have Win XP Home w/SP3. I would like to be able to do a “whole sale” edit of the reqistry to grant full access to everything in the reqistry rather than having to change one entry at a time when I try to modify or delete a key. One good area where this is a nuisance is in the area of the registry that deals with “Legacy” keys. Thanks.
Thanks for the great article, now I have a couple other ways to get access to files on drives from other computers, while backing up or restoring folders and files.
What I would like to know is why sometimes I have access to the shared drives and sometimes I do not. I have experienced the access denied using an XP machine and trying to access both XP and Vista disk from other machines attached via a SATA/IDE to USB adapter. Sometimes the XP machine adds the Admin account to the disk without any action taken by me, sometimes I have to take ownership and add the account to the folder I need to get access. Makes no sense?
OMG i love you this has just saved about 4 yrs of my stuff, i could not be more thankful, i wish i could had found this sooner.
the main options I recommend is whenever a system requires a reformat and a backup of user files is to either
a> first put the files in question on a FAT32 volume / partition / disk
– file ownership & permissions don’t follow files to anything that’s formatted with FAT32
or
b> restore said file(s) from the backup to a FAT32 volume / partition / disk
same thing applies the backup program will usually restore the files and the file ownership / permissions lockout info will not follow the file and you will have full access to the file(s)
or
c> archive the files on CD/DVD which is
CDFS for Data CD’s or UDF for Data DVDs
neither format supports the NTFS permissions, which is where the problem happens to be.
I have the same problem as the article, but the thing is after I’ve unlocked the folder, the files inside are still locked. In order to unlock it, I have to repeat the same process but on each individual file before I get to use.
Thing is, one of these locked folders have ALOT of files, so unlocking them one by one is a bit impractical. Are there ways to do this faster or multiple files folders at a time? I am using Windows 7 64 Bit Home
01-Feb-2011
Thanks for the artical. On A win 7 64 bit system you have to take control of the folder and all the sublets folders. Make sure you have the right person to do it. There are several persons it the ownership window. Make sure you pick the right owner when you take ownership. Hope this helps.
Leo,
Thanks a million! Had tried everything – even Microsoft Help, which, of course, used the “See your Administrator” fudge when it got down to the nitty-gritty of giving a helpful answer. Why MS can’t give the instructions like you did is beyond me.
Thanks Again, N-Ray
Thank you so much for the helpful information! The command prompt solution was so useful and finally unlocked my files and relieved me of so much stress. Thank you Leo.
I just wanted to say thank you for such a helpful and easy to understand guide.
I put the HDD from my dead desktop into an enclosure but couldn’t access the files – but now I can!
Leo
Many thanks for this. I went the “windows” route and it worked for me. I had been searching for a solution to this problem for over three hours, literally! Many thanks, again.
Phil
None of this works on W7 with a FAT32 drive, I wish I could find a similar article about that. “takeown” just gets me “ERROR: File ownership cannot be applied on insecure file systems; there is no support for ACLs.” and attempting to delete a file on the drive gives me “You require permission from Everyone to make changes to this file.” It’s a write protect problem of some kind, and all I’ve found so far is a registry policy setting for write protect on StorageDevicePolicies that also didn’t fix the problem.
I’ve been searching through all kinds of forums and articles with no success so far…
14-Nov-2011
I did the command prompt path and it said success on taking ownership of the files, but I still can’t view them or move the folder over to my other hard drive. It still says that I don’t have the permissions.
Hi man
Thanks you’re a life saver.
One last question – most of the folders still have padlocks on them, and although I can access them, I have to manually change the permissions to move them.
Any way of bulk changing that?
Many thanks
Try the specified commands from the drive’s root folder.
Hello everyone, i discovered another simple and alternative way of getting your file permission and control. All i did was to select all the files (not the folder),
*clicked on Share with(this can be found on the property bar)
*clicked specific people,
*in the file sharing interface, i typed everyone, clicked add, also changed permission level to read/write
*finally clicked share.
How do I make it ask me to add settings for all containing files/folders if it is not asking me?
Worked like charm! I have 3 desktops networked and could only access Public files from each, this did the trick!
Thanks so much! This issue was driving me crazy. Had lots of data and files.
I am trying to script a solution that would do the equivalent of adding an Everyone group to the security, and then giving full control (clicking all the allow boxes in the everyone permissions). This is exactly what you do in the first part of the article. When, however, I try using some combination of the command line takeown and icacls, it does not quite do the same thing. It adds the Everyone, but does not check any of the permissions in that part of the GUI. Any suggestions what I may be doing wrong?
I tried this and although the permissions changed to allow all access, I can’t copy my old files to my new laptop. I still get the same error message about needing admin permission. My old laptop is XP and my new one is Win 8 but I also tried it on a Win 7 desktop and got the same message.
Thanks…. worked for me…
I tried this in Windows 8 and had the same issue as Dave in that the permissions (when using the “Windows Way”) seemed to work but I could still not access the files. I tried the command shell and it 1) it did not have a “takedown” command. 2) icacls gave me an Access denied error. Some more detail (in case it is relevant): I’m trying to copy files from a harddrive extracted from an old computer. I would like to access: “…/users/myaccount/Local Settings” Local Settings is a link which may be causing additional problems. Can anybody offer insight as to whether this can be done in Windows 8? Thanks.
26-Dec-2012
Actually, Leo, and in fairness to Brad, even though I actually know the correct terminology… yes, I keep mis-reading it as “takedown,” too! : (
hello there :)
i used your method but i cant access files still i have photos that are not opening
please help
Thanks again Sir this is a complete tutorial be it windows or command prompt, you’ve helped me again and again, where others can’t, you have it complete. God bless.
What can be done when the acces is denied not only in a file, in the local hard drive indeed?
ya im having the same problem it keeps saying access is denied idk what else to do trying to fix for my mom ugh ….please tell me how to change parameter too??????????
What if processing a file is failed in the “what you use” approach? I tried all of the approaches listed above, yet one failed still and I have no idea what to do now
I have a similar issue with a portable 1Tb drive (and increasingly, with high-capacity USB sticks) that I use on both my desktop PC and my laptop. Every time I swap from one to the other, I get the “you don’t have permissions” problem.
Do I have to add ‘everyone’ from EACH machine I intend using a device on, and do I need to do it every time I add files to the device? This seems very time-consuming…
Thnx a lot dear…
It helped a lot to me ..
u r genius…
This seems to have worked for me – however it may have unintended consequences; I recently recovered my Windows 7 OS and had the problem with permissions. Then I used your solution and all seemed well; then some Windows updates appear to have failed or corrupted things.
Leo,
This was a very effective solution to my problem. I had restored the files from a WD Smartware backup to a new hard drive and could not access the files due to an NTFS permission issue on a Windows 7 machine. I simply applied the command line option to the users’ directory structure for only the intended user, not everyone, and problem solved. Thank you very much for posting this solution.
I must say, the GUI way has always been completely useless and annoying for me, yet the cmd prompt method was super quick, easy, and effective. Thank you! Often cmd prompt really is the way to go.
Hey buddy thanks a lot for the command line thing – I remember DOS back in the olden days but never really used it as I got a Windows 3.1 PC lol. The commands worked a treat. I had recently moved to SSD and when I plugged my old HD into a borrowed caddy thing I couldn’t access all the photos and important data I had collected over years! Never going to be a problem again as I will promptly order some sort of RAID set up! Thanks!!
downloaded Security Essentials but can’t open it because of error message: this program is blocked by group policy, for more info contact administrator
Typically malware. Try using Windows Defender Offline.
Windows Defender Offline? What’s that? It sounds very useful — could you please point us in the right direction to get it???
A search of my site will quickly tell you: https://askleo.com/windows_defender_offline_scan_your_computer_for_malware_without_booting_windows/ and https://askleo.com/windows-defender-offline-in-windows-10/ :-)
Thank you Leo,
The takeown command helped me free up 15 gigs worth of files trapped by an old account on my computer.
My pen drive FAT32 file types, but now I want to change to CDFS file, how can I do?? PLEASEA HELP ME
Read more: How to format pen drive to cdfs ? – My pen drive FAT32 file types, but now I want to change to CDFS file, how can I do?? PLEASEA HELP ME …..
I don’t know that you can. CDFS is specifically for CDs.
Thanks for the tips,
“takeown /F * /R” worked for me!
I have used this on hundreds of Windows PC’s.
Works like a charm. It simply adds “Take Ownership” to the right click list.
http://www.howtogeek.com/howto/windows-vista/add-take-ownership-to-explorer-right-click-menu-in-vista/
Last week, I changed the permissions on my Seagate 1TB External Hard Drive because I thought I know how to change the permissions wherein files can’t be copied from the hard disk to any computer. The result was that I can’t modify the files and transfer any files to the hard disk. I’ve search a lot of times of how I could fix this problem then I stumbled upon this article. THANK YOU VERY MUCH, LEO. :D
I would like to ask if you can tell me how to enable/disable copying of files from my hard disk because I get bothered when people who borrow my hard disk can easily copy files without me knowing. Thanks.
Nope. If you can read them they can read them. The only solution would be to encrypt them.
Excellent tips! The takeown command was enough to grant access to the locked folder! :)
Thanks a lot
Howsoever long the path may be, you can always rely on Long Path Tool. Its sure to sort out your problem.
Hi
I wanted to change the security properties for one of my drives, and from That drive’s Properties/Security I’ve removed access For Users and after that ALL FILES AND FOLDERS on that drive disappeared. After that I tried to undo it but I can’t. I’ve tried these commands takeown and icacls but can’t work with all files. Can you please help me ?
Yeeeessssss! It worked! Many many Thanks!
none of this works with windows 10 – or maybe a better explanation on the command lines would help – ie where are the spaces etc.
Finally, somebody who answered my question exactly AND in words that made sense to me.
This worked great.
I have a Windows XP machine that died but the hard drive was salvagable. I removed the old hard drive and connected it to a Windows 8.1 machine. The files in My Documents could not be accessed because “I don’t own my files.”
Now I do.
Thank you again.
THIS article was a GOD SEND! I hooked up my crashed hard drive from my laptop to a cloning cable and was able to access my USER folders… but only had access to the PUBLIC folder and not the OWNER folder which had everything I needed. So, following this article, I right clicked on the owner folder and selected properties… went to the security portion and created an EVERYONE name giving it full control. ALL of my files were unlocked and I nearly CRIED!
Thank you!
Thanks dude, the second cmd method worked for ne.
Tyvm
MAD MAD MAD Microsoft can not access my files !!! Nothing helps !!! And now go and buy new shiny Laptop With MS on it just find out how can not access your files again !!! Shoot the Microsoft !!! Microsoft OS is threat to the user !!!
The easiest thing to do is to access the drive in question via a live Linux Mint disc/k (either a DVD or USB image) gotten free off of the ‘net. Copy the folders you want to another HDD, then format the one you’re using that has the permissions issues (connect back to Windows & do a quick format).
Now, copy the folders from the other drive back to your original, and now freshly formatted, HDD. The drive & data is now accessible from any PC.
Cheers
Hello. I accidentally changed some settings on my laptop that enabled me to prevent sharing of my data via USB disks. I seem to have forgotten how to remove this setting. My laptop reads USB disks but won’t open and displays “This operation has been cancelled due to restrictions in effect on this computer. Please contact your system administrator.”
How can i open SQlite files? I regulary clean my browsing history on google chrome, does that mean my “archived history” on c disk is also deleted?
What can i read from sqlite files and how can i read it? If i wanted to read my browsing history on c disk could i read it by opening sqlite file (even if i deleted my browsing history on google chrome)?
Thank you so much, I was getting in a bit of a panic on a recently updated Excel sheet I was unable to access. Your knowledge is appreciated
Useless !!! When program like CCE (Comodo Cleaning Esentials ) tamper and change UAC then if one have only one account active under Administrators Group CCE drops down user rights to PC Users and no administrative access any more at no level ! Since Administrator Account is not enabled one can not change nothing being locked out ! This is only possible with MS where even Administrator Account can be locked out also ! What’s the point with possibilities such locking out Administrator ? So someone that can use back-doors in Win can gain full access ! This is why all nasty stuff is happening under MS OS !!! And now what since i’m being locked out of my system what can i do ??? FORMAT – YES – Install WIN – NO ! I’m going to use some Linux at least they do not have possibility to lock Administrator Account/Access out ! Under Linux Administrator is true Administrator and SU command works like a charm every time not so with Windows where run as Administrator have serious issues also like not being able to access folder Program Data and so on with administrative credentials app wont install/wont work! MS is playing nasty on user cosign problems where problems can be easily avoided and enabling possibility for such problems at all ! With MS you are newer in full control of OS even under Administrator Account !!!
Thanks – your tips were a great help to get my old notebook sata NTFS drive contents backed up via usb to my new notebook.
HELP! None of the options in the article work for me. Situation: a folder was created on a network drive by a Windows 10 Home laptop that has since been returned to BestBuy. Then I logged onto the PC where the folder was created (it’s running Windows 7 Pro) as a user in the administrator group. Using the “Windows method” shows “You do not have permission to view this object’s permission settings” when I right-click on folder, select Properties and then click on the Security tab. Same message when I click on Advanced. I then clicked on the “Owner” tab, then on Edit, checked “Replace owner on subcontainers and objects”, highlighted “Administrators” and clicked OK, and got “Access is denied” error. I got the same error when I highlighted the username that I was logged in as (member of Administrators group).
takeown /f folder_name /r /d y yields the following: ERROR: Access is denied.
icacls folder_name /grant:r UserNameInAdminGroup:F /t /q yields the following:
folder_name: Access is denied.
Successfully processed 0 files; Failed processing 1 files
Any suggestions on how to get access to this folder so I can deleted would be greatly appreciated.
It’s not enough to be logged into an account that’s in the administrator’s group. You need to run the command prompt *as* administrator, as outlined in the article.
Try it again, dude. But this time, don’t just click on the “command prompt” link right away. Right-click on it instead, and then click on “Run as Administrator” in the resulting menu.
Once again, a command prompt window should open up, but this time it should look a little different from what you got previously.
Now try those “ownership” commands again, and see if you don’t have better success.
Hope this helps! Good luck! :)
I just bought my HP laptop. There were only 2 drives i.e. C drive and a recovery drive.. Now all of a sudden, there appeared a new F drive of 256 MB that i don’t have access to open.. I am not sure what to do.. Can someone please help ?
I’d ignore it. Seriously, it’s probably the recovery drive, but if it’s not causing a problem I’d just ignore it.
Ever since I installed Windows 10 on a new SSD probably close to a year ago, I’ve been unable to access many files on my old Windows 7 hard drive which is still in my computer. The icalcs command FINALLY allowed me to access my files! Thank you so much for this helpful guide!
Hi Leo,
I’ve noticed that when you get the “access or permissions denied” message, simply clicking the folder again will grant access, to that folder and all sub-folders.
On large wrapper folder like “Users” it may take a while, I’m guessing that icacls is running in the background.
Another method I use is to boot with a Recovery or Install DVD, and enter Command Prompt. From there copy what you need with Robocopy.
Leo –
On an external hard drive with NTFS, I would like to remove any and all restrictions on it so that anyone can use the external HD (open files, read, edit, save, etc.) regardless of which Windows computer the HD is connected to and which user account is used (even a non-administrator account).
1. Can I use the above GUI method to accomplish this?
2. Can I execute the GUI method starting on the external HD root directory (ie., the highest one with the volume label, such as “(E:)”)? Or does it need to be on the next lower folder(s)?
3. Before I even add any data to it, can I use the GUI method to “condition” the external HD so that anyone can later easily access whatever data I put on it?
If I should pass before my wife, I don’t want her to have to deal with stuff like ownership, permission, access denied, and read-only hassles on files I leave behind on my external HD’s. As much as possible, I want to provide a headache-free experience like the one you get when using a USB flash drive with FAT32.
Thanks.
1. It should work for external drives, but generally, all users have full access to external drives by default.
2. Yes. Right click on the drive in the left-hand column and right-click on the drive letter and click Properties.
3. Yes
As Mark said, yes to all. Wanted to add that I’ve done this explicitly on external drives when that external drive is a formerly internal drive that I’ve wanted to get files from.
Thank you so much, I’ve looked at 15 different posts most of whom were trying to sell me something and of course not 1 of them had the simple statement “right click on Icon and choose Run as Administrator” which is all I needed.
Hi Leo,
I love your YT talks, BTW
I have a partition in FAT 32 that wish to copy my EFI boot files to. I cannot open it due to “Access Denied”. The properties popup does not have a security tab. So I decided I would take ownership as I had entered the registry tweak for this. However the command “Take Ownership” does not appear in the context menu for a drive/partition.
The partition appears in My Computer and Disk Management, but neither will let me in.
Can you suggest a way of getting in without reformatting to NTFS?
Many thanks
Brian
Not offhand. It’s possible that it’s protected/formatted in such a way as to prevent exactly what you’re attempting.