What Does the 'Access Denied' Error Mean
The 'Access Denied' error (code 0x80070005 or 5) occurs when the Windows operating system does not allow your user account to perform an operation (read, write, execute) on a file, folder, registry key, or other system object.
Typical scenarios where it appears:
- When trying to open, save, or delete a file/folder.
- When launching a program installer or the program itself.
- When accessing a network share or printer.
- In a console (PowerShell, CMD) when executing a command that requires elevated privileges.
- In the Windows installer or during a system update.
The full error text may vary: Access is denied, Failed to access..., You don't have permission to perform this action.
Causes
The error is not a 'bug', but an intentional security mechanism. Here are the specific causes:
- Insufficient user permissions (ACL). The user account is not part of the group to which the system has assigned permissions on the object (e.g., only
Administratorshave access). - Object ownership (Take Ownership). You are not the owner of the file/folder, and the current owner has no permissions configured for your user account.
- User Account Control (UAC). Even if you are an administrator, you operate in a standard context. For critical operations, explicit privilege elevation ("Run as administrator") is required.
- Blocking by antivirus/Windows Defender. Real-time protection (RTP) implementation may temporarily block access to suspicious or active files.
- Corruption of ACL or metadata. A system crash, improper program termination, or virus attack could have damaged the access control lists.
- File locked by another program. The file is in use by another process (e.g., open in another program), and the system will not let you modify/delete it.
- Network restrictions. When accessing network resources, share permissions or another user's credentials may be applied.
- Corruption of system files. Damage to
ntoskrnl.exe,sam.sys, or other security-related components.
Solutions
We recommend starting with the simplest and safest method and progressing to more complex ones.
Method 1: Run as Administrator
This is the first thing to try. Many system and even user folders (e.g., C:\Program Files, C:\Windows, C:\Users\Public) require elevated privileges for writing.
- Locate the file, program, or folder you cannot access.
- Right-click on it.
- Select "Run as administrator" (for programs) or open Properties → Security tab → Advanced and try to change the owner/permissions (the system will request UAC confirmation).
- If the operation succeeds, the problem was insufficient permissions in the current session.
Method 2: Changing Permissions (ACL) via the Graphical Interface
If running as administrator didn't help, you need to explicitly grant permissions to your user account.
- Right-click on the file or folder → Properties.
- Go to the Security tab.
- Click Edit (or Advanced for finer control).
- In the "Group or user names" list, click Add.
- In the "Enter the object names to select" field, enter:
- Your username (e.g.,
John), or - The
Usersgroup (for all standard users), or - The
Administratorsgroup.
- Your username (e.g.,
- Click Check Names → OK.
- Select the added entry and check the required permissions at the bottom. For full control, select Full control or Read & execute / Modify.
- Click Apply → OK. UAC confirmation may be required.
- If you are changing the owner in Advanced, check the box "Replace owner on subcontainers and objects" for recursion.
Method 3: Taking Ownership and Resetting Permissions via Command Line (icacls)
This is the most powerful and universal method, working even with unresponsive interfaces.
- Open Command Prompt (cmd) or PowerShell as administrator. (Right-click the shortcut → "Run as administrator").
- To take ownership (if you are not the owner):
takeown /F "full_path_to_file_or_folder" /R /D Y/F— specifies the path./R— recursively for all subfolders and files./D Y— automatically answer 'Yes' to all confirmation prompts.
- To reset and assign permissions (most common scenario):
icacls "full_path_to_file_or_folder" /reset /T /C/reset— resets ACLs to default inherited from parent./T— applies to all subfolders and files./C— continues on errors (skips files still inaccessible).
- To explicitly grant permissions (e.g., full access to the
Usersgroup):icacls "full_path_to_file_or_folder" /grant "Users":(F) /T /C(F)— full control. Alternatives:(M)— modify,(RX)— read & execute,(R)— read only.
Example: For the folder D:\Projects\MyApp:
takeown /F "D:\Projects\MyApp" /R /D Y
icacls "D:\Projects\MyApp" /grant "Users":(M) /T /C
Method 4: Checking and Disabling Antivirus / Windows Defender
Antivirus software often "intercepts" file access for scanning, which can conflict with other programs.
- Open your antivirus control panel (Avast, Kaspersky, ESET, etc.) or Windows Security (Win + S → "Windows Security").
- Find the Real-time protection, Antivirus protection, or App & browser control section.
- Temporarily disable this protection (for 5-10 minutes).
- Try to perform the action that caused the error.
- If the error disappears, do not leave the antivirus disabled! Instead:
- Add the path to the problematic folder/file to your antivirus exclusions.
- In Windows Defender: "Virus & threat protection" → "Manage settings" under "Virus & threat protection settings" → "Add or remove exclusions" → "Add an exclusion" → "Folder".
Method 5: Checking System File and Disk Integrity
If the error affects system objects or appeared after a crash, file corruption may be the cause.
- Run System File Checker (SFC):
- Open Command Prompt as administrator.
- Enter the command:
sfc /scannow - Wait for completion (may take 10-20 minutes). The system will attempt to automatically repair corrupted files.
- Run Disk Check (CHKDSK):
- In the same Command Prompt:
chkdsk C: /f(replaceC:with the appropriate drive letter). - If the disk is in use, the system will offer to schedule the check on the next reboot. Agree (Y) and restart your computer.
- In the same Command Prompt:
- After reboot, the check will run automatically. Then retry the access.
Prevention
To minimize the risk of the 'Access Denied' error:
- Work in the correct context. For installing programs, changing system settings, or working with files in protected folders (
Program Files,Windows), always use "Run as administrator". - Follow the principle of least privilege. Do not use an administrator account for daily work. Use a standard account and elevate privileges only when necessary (UAC).
- Configure antivirus exclusions for folders with development software, game mods, or frequently changing data that the antivirus might mistakenly block.
- Regularly create system restore points. This allows quick rollback if the error was caused by a failed permission change or software installation.
- Do not change permissions on system folders (
C:\Windows,C:\Program Files) unless absolutely necessary. This can disrupt OS functionality and create security vulnerabilities. - Use standard paths for user data. Store documents, projects in folders within
C:\Users\YourName\(Documents, Downloads, Desktop). Your user account already has full access to these.