Some folders within the Windows operating system are locked/ restricted so that unauthorized changes cannot be made to them. This is usually for good reason since any changes within those folders have the potential to harm the OS or its functionality. Nonetheless, you can still access them and make any changes.
This can be achieved by taking ownership of the directory. Restricted folders are often owned by either “TrustedInstaller” or “System,” and even an administrator account is not allowed to modify those. However, if you get ownership of the directory, then you may do with it what you please.
Table of Contents
When trying to access these folders with an administrative account, you will probably come across the following prompt:
You don't currently have permission to access this folder. Click Continue to permanently get access to this folder.
As stated in the dialog box, clicking Continue will get you into the folder or permit you to make changes to it, but only if you are logged in using an administrative account. This is not always true, since granting access also depends upon what type of security the folder has. Some folders can be accessed like this, whilst some have stricter security and throw another prompt given below.
That said, if you are logged in with a standard account, then clicking Continue will show you another similar prompt stating the following:
You don't currently have permission to access this folder. To gain access to this folder you will need to use the security tab.
In this case, there is no other option but to take ownership of the folder from the “Security” tab within the folder’s properties. However, even so, if using a standard account, you will need to provide the credentials of an administrative account while taking ownership of a folder, and the ownership rights will be assigned to that administrative account, and not the account you are logged in from.
Therefore, it is recommended that you always take ownership of a folder while logged in from an administrative account.
Now that this is clear, let us move on to show you different ways to take ownership of a folder.
How to Take Folder Ownership using Security Tab
One of the methods of taking ownership of an account is using File Explorer to open the folder properties and then use the Security tab to change its owner. Here are the complete steps to get the job done:
Note: Taking ownership of restricted directories will grant you access and permission to manipulate its contents, but we suggest that you only do so if you know what you are doing. Any unauthorized changes can result in a fatality for the OS. Therefore, we recommend that you create a system restore point before moving forward.
Using File Explorer, right-click on the folder that you want to modify and then click Properties from the context menu.
From the Properties window, switch to the Security tab and click Advanced.
In the “Advanced security settings” window, click Change in front of the Owner field.
In the “Select User or Group” popup, enter the name of the user account you want to make the owner in the “Enter the object name to select” section. In this example, we wrote “Subhan.”
Once the name is entered, click Check Names and it will automatically pick up the Distinguished Name (DN) of the account, which includes the computer name combined with the user account name. When done, click Ok.
Alternatively, you can also enter a group, such as “everyone,” and make all members of that group the owners of this folder.
Now back on the “Advanced security settings” window, check the box next to “Replace owner on subcontainers” and click Apply.
You will now see a dialog box asking you to close and reopen the folder properties. Click Ok and then proceed to close the windows.
Now repeat steps 1 & 2 from above to reopen the “Advanced security settings” window.
Click Add to add permissions for the new owner of the directory.
Click Select a principal to select the user account and assign permissions.
Now add a new principal by typing the account/group name in the “Enter the object name to select” section, then click Check Names and Ok.
Now check the box next to Full Control to give all permissions to the principal account/group selected in the step above. This will automatically check all of the remaining boxes. Click Ok when done.
Now back on the “Advanced security settings” window, click Apply and Ok to save and implement the changes. If prompted for a confirmation, click Yes.
You should now be able to access and make changes to the folder to which previously you were unable to.
Even though this process gets the job done, it is still a lengthy one. If you would rather achieve the same task much quicker, you can opt for the second method shared below.
How to Take Folder Ownership using Command Prompt
Taking ownership of a directory using the Command Prompt is relatively simpler than the process discussed above. Here is how:
Note: This method changes the owner of a folder to the user account you are logged in from.
Launch the Command Prompt with elevated privileges while logged in from an administrative account.
Now execute the following cmdlet while replacing PathToFolder with the complete path to the directory to which you want to change the owner.
takeown /F "PathToFolder”
As you can see above, the owner of the selected folder was immediately changed, and you should now be able to access and modify the restricted folder.
Alternatively, you can assign the entire Administrative group as the owner of the directory as well as the subcontainers by adding the /A and /R switches. Here is an example:
takeown /F "PathToFolder" /A /R
Add “Take Ownership” to Context Menu
Another method to quickly take ownership of a folder, as well as the subcontainers and files inside of it, is by making a little tweak in the Windows Registry. Applying this tweak will add the option of “Take Ownership” in the context menu of a folder. Upon clicking this option, the user account you are logged in with will immediately get ownership privileges.
Instead of manually making any changes, we have compiled a .REG file that will make all the necessary changes for you.
Note: Misconfiguration of critical values in the system’s registry could be fatal for your operating system. Therefore, we insist that you create a system restore point before proceeding forward with the process.
Click on the link below to add the “Take Ownership” option to the context menu:
Add Take Ownership To Context Menu (806 bytes, 248 hits)
Simply execute this file on your computer and proceed through with any UAC or confirmation prompts.
If you want to remove the option in the future, download and execute the following .REG file:
Remove Take Ownership From Context Menu (341 bytes, 208 hits)
With great power, comes great responsibilities. Taking ownership of a folder/directory will allow you to view its contents as well as make any changes to it. However, in the wrong hands, anyone else using your user account can also make unauthorized changes to it. Therefore, we emphasize that you only make the necessary changes and then revert the ownership.
You can repeat the first method shared above (take ownership from folder properties) and change the owner back to its original.