How To Remove The Folder Lock Icon and access locked folders in Windows
If you open Windows Explorer in the Windows operating system you will eventually come upon some folders with a lock icon.
If you try to open those folders you will get an access denied error message. The lock icon indicates a file or folder with special permissions and that the active user is restricted from performing some - or even all - operations on that file or folder.
You need to make sure at the beginning that you are logged in with the right profile before continuing. If you are, you need to assess the situation. Do you need access to the folder? What operations are available and which are blocked?
The best option in most cases is to take ownership of the folder with the lock icon so that you can perform all file operations on it.
Checking folder ownership
This is done by right-clicking the folder with the lock icon and selecting properties from the context menu.
This should open the properties window of the folder name. Switch to the Security tab and click on the Advanced button near the bottom of the screen.
This opens yet another window called Advanced Security Settings for [folder name]. Switch to the Owner tab to see the current owner of the selected folder.
You can change the owner of the folder by clicking on the edit button. This opens a new window with options to change the owner of the folder to another user. Click on Other users or groups if the user is not displayed in the initial change owner to listing.
You have to manually enter the username, click on check names and ok to change the ownership of the folder to that user.
The lock icon may still be there but the selected user should now have the rights to perform all file operations (like copying or deleting files) in that folder and all subfolders.
The lock indicates special permissions which means that we need to get rid of these. There are two options, an elegant one that might work and a brute force one that will work.
Elegant solution to remove lock icon
Go back to the Security tab of the folder properties window. Click the Advanced button at the bottom and on the Change Permissions button in the next window. Locate the checkbox "Include inheritable permissions from this object's parent" and place a checkmark in it. Click the apply button.
This might be enough to remove the folder lock icon. If it does not head over to the brute force method.
Brute force method to remove folder lock icon
Create a new folder in the same directory level. Now copy all files and folders from the old folder into the new, delete the old folder and rename the new folder so that it has the same name as the old one. This only works if the file permissions of all files and folders inside the problematic folder are not showing lock icons as well.
Do you know of other solutions to remove the lock icon on folders in Windows? Let us hear about them in the comments.
$ chown dotancohen: folder/
Great. The Elegant Solution worked just fine.