[{"data":1,"prerenderedAt":212},["ShallowReactive",2],{"en-post-102":3},{"id":4,"title":5,"body":6,"description":197,"extension":205,"meta":206,"navigation":207,"path":208,"seo":209,"stem":210,"__hash__":211},"content/post/102.md","102",{"type":7,"value":8,"toc":196},"minimark",[9,14,18,66,75,79,118,122,140,144,155,161,167,173,177],[10,11,13],"h2",{"id":12},"why-access-is-denied","Why access is denied",[15,16,17],"p",{},"This problem is most common after reinstalling Windows, moving a drive, or restoring from backup, because the new account is technically a different user even when the name looks identical. The steps below fix it without third party tools.",[19,20,21,45,48,56,59],"ul",{},[22,23,24,25,29,30,33,34,29,37,40,41,44],"li",{},"The owner of the file or folder is ",[26,27,28],"code",{},"SYSTEM",", ",[26,31,32],{},"TrustedInstaller",", or another user. This is common for system folders like ",[26,35,36],{},"Windows",[26,38,39],{},"Program Files",", and ",[26,42,43],{},"ProgramData",".",[22,46,47],{},"Broken permission inheritance. Files moved from an old system or old drive still point their access control list at the previous user, so your current account has no rights.",[22,49,50,51,44],{},"BitLocker or EFS encryption. Encrypted files cannot be opened until decrypted, covered in ",[52,53,55],"a",{"href":54},"/post/44/","Windows BitLocker full disk encryption",[22,57,58],{},"The file is in use, locked by a program, so it cannot be deleted or moved, and you need an unlock tool.",[22,60,61,62,44],{},"Controlled folder access or similar protection blocked it by mistake, see ",[52,63,65],{"href":64},"/post/85/","Windows Security Center Defender",[15,67,68,69,71,72,74],{},"Important warning, do not force permission changes or deletion on system folders, especially system files inside ",[26,70,36],{}," and ",[26,73,39],{},", or you may break the system. Only operate on folders you created or moved from elsewhere.",[10,76,78],{"id":77},"fix-ladder","Fix ladder",[80,81,82,85,92,95,98,105,108],"ol",{},[22,83,84],{},"Run as administrator, right click the program or File Explorer and choose \"Run as administrator\" before you act.",[22,86,87,88,91],{},"Take ownership, right click the folder, Properties, Security, Advanced. Next to \"Owner\" at the top, click Change, enter your user name or ",[26,89,90],{},"Administrators",", click Check Names, then OK. Check \"Replace owner on subcontainers and objects\" and apply.",[22,93,94],{},"Grant full control, still on the Security tab, click Edit, add your user, check \"Full control\" in permissions, then OK. If permissions do not inherit, go to Advanced, \"Enable inheritance\", or delete the conflicting deny entry first.",[22,96,97],{},"Command line for stubborn or bulk folders, run the following as administrator, replacing \"path\" with the full folder path and \"username\" with your account name.\nicacls \"path\" /grant username:F /t\ntakeown /f \"path\" /r /d y",[22,99,100,101,44],{},"Safe mode, boot into Safe Mode and use the built in administrator account, method in ",[52,102,104],{"href":103},"/post/27/","Reset this PC system restore",[22,106,107],{},"Unlock in use, use tools like Unlocker or IObit Unlocker to release the file lock before deleting.",[22,109,110,111,71,114,117],{},"Still failing, it may be disk errors or corrupted permissions. Run ",[26,112,113],{},"sfc /scannow",[26,115,116],{},"chkdsk",", and if needed, back up and reset the system.",[10,119,121],{"id":120},"prevention","Prevention",[19,123,124,127,130,137],{},[22,125,126],{},"Before copying files from an old drive or system, take ownership on the source machine first, or copy to a non system drive.",[22,128,129],{},"Keep important data backed up so you are not forced to fight permissions, the habit is worth building.",[22,131,132,133,44],{},"Whether you use a local or a Microsoft account affects the permission model, differences in ",[52,134,136],{"href":135},"/post/55/","Microsoft account to local account",[22,138,139],{},"If you delete by mistake while changing permissions, file recovery can still save it.",[10,141,143],{"id":142},"faq","FAQ",[15,145,146,150,151,154],{},[147,148,149],"strong",{},"Takeown keeps asking yes or no?"," The ",[26,152,153],{},"/d y"," flag auto answers yes for directories, which is why it is included in the command above. Without it, you would confirm each folder manually.",[15,156,157,160],{},[147,158,159],{},"I took ownership but still cannot delete?"," Add the full control grant with icacls after takeown, and if inheritance is broken, enable it in the Advanced Security dialog before retrying.",[15,162,163,166],{},[147,164,165],{},"This happens on an external hard drive from another PC?"," The access list still points at the old PC user. Take ownership on the new PC as described, then the files become accessible.",[15,168,169,172],{},[147,170,171],{},"Should I change permissions on Program Files?"," Avoid it. Those folders are protected for a reason, and forcing changes can break apps or the system. Only adjust folders you own or moved.",[10,174,176],{"id":175},"further-reading","Further reading",[19,178,179,186,191],{},[22,180,181,182,44],{},"Registry and group policy also hold permission related policies, common in enterprise, see ",[52,183,185],{"href":184},"/post/61/","Registry editor group policy",[22,187,188,189,44],{},"After a bad permission change, a system restore point can roll things back, in ",[52,190,104],{"href":103},[22,192,193,194,44],{},"Access loss from encryption is painful if the recovery key is lost, back it up ahead of time in ",[52,195,55],{"href":54},{"title":197,"searchDepth":198,"depth":198,"links":199},"",2,[200,201,202,203,204],{"id":12,"depth":198,"text":13},{"id":77,"depth":198,"text":78},{"id":120,"depth":198,"text":121},{"id":142,"depth":198,"text":143},{"id":175,"depth":198,"text":176},"md",{},true,"/post/102",{"description":197},"post/102","_eVPSDf2J64MbgKdisWQJVYlFpO4vy-jndNP7jpliAg",1794378304517]