Could Not Set File Security for File Error 5
The message “Could not set file security for file” usually means Windows tried to change permissions on an installer file and was refused. In this situation, the file is often inside `D:\Config.Msi`, and the problem may appear while removing Python or another Windows program.
The key question is not simply “How do I force this uninstall?” First check two things:
- Does the account have enough access?
- Is the drive in the error message still available?
If Windows is looking for `D:\Config.Msi` but the computer no longer has a usable D: drive, changing permissions on another folder may not help.
What “Could not set file security for file” Error 5 means
On Windows, Error 5 means “Access denied.” In other words, the uninstall process reached a file but could not update its security settings.
A typical message may look like this:
> Could not set file security for file `D:\Config.Msi\xxxxx.rbf`. Error 5.
The `.rbf` part is an installer rollback file. Windows may use files like this while installing, repairing, or removing a program. If the installer cannot read or update the file, it can stop before the uninstall finishes.
Common reasons include:
- The account running the uninstall does not have sufficient permissions.
- The file or folder has security settings that block the installer.
- The installer expects a drive that is missing or unavailable.
- The original installation location is no longer connected.
- The uninstall entry still points to an old installation path.
This is why could not set file security for file error 5 Python reports often appear when users try to remove Python through Windows Settings or Control Panel. The error points to a permission or installation-location problem. It does not prove that Python itself is damaged.
Also, an administrator account is not a guaranteed fix. Windows can still block access to a particular file, folder, or installer action.
Why Config.Msi and a missing installation drive can trigger the message
`Config.Msi` is connected with Windows Installer activity. Error messages often name a path such as:
```text
D:\Config.Msi\xxxxx.rbf
```
The drive letter matters. If Windows says the file is on D:, check whether D: is actually available before changing permissions.
The old installation may have been stored on:
- A second internal drive
- An external drive
- A removable drive
- A mapped network location
- A drive that was renamed or removed
For example, Python may still be installed on the current Windows drive, but its uninstall record could refer to installer files that were originally created on D:. Windows then tries to reach `D:\Config.Msi` and fails.
Do not assume that `D:\Config.Msi` is the same as `C:\Config.Msi`. A permission change on the wrong drive will not repair the path shown in the error.
Before proceeding, check:
- Open File Explorer.
- Select This PC.
- Look for the drive named in the error.
- Open it if it appears.
- Check whether the reported folder exists.
If D: is an external or removable drive, reconnect it and restart the uninstall. If it is a network location, make sure it is connected in the same Windows session where you are running the uninstall.
Do not delete `Config.Msi` just because it appears in the message. It is an installer-related folder, and deleting system installer files without a recovery plan can create a second problem.
Check whether the account has administrator access
Start with the account itself. This check is quick and avoids changing folder ownership when the account is simply a standard user.
Check the account type in Windows
On Windows 10, open:
Settings → Accounts → Your info
The account details should indicate whether the account is an administrator. You can also open:
Control Panel → User Accounts → User Accounts
Look for the account type shown there.
If the account is a standard user, sign in with an administrator account before retrying the uninstall. You may also see a permission prompt during the removal process. Enter valid administrator credentials if Windows asks for them.
Still, administrator access does not mean every file can be changed automatically. Windows may apply separate permissions to the affected folder, and the installer may still be trying to use a missing drive.
Run the uninstall from an elevated session
An elevated session is one where Windows gives the program administrator-level permission after confirmation.
You can test this by opening the uninstall route again and approving the User Account Control prompt. If another person manages the computer, ask them to run the uninstall from their administrator account rather than only entering a password after the process has already started.
If the same error names `D:\Config.Msi`, note the exact path. The drive and folder still need to be checked separately.
Try uninstalling Python from Windows Settings
If you are removing Python, try the normal Windows uninstall path before changing security settings.
- Open Settings.
- Select Apps.
- Open Apps & features.
- Find the Python entry in the list.
- Select it.
- Choose Uninstall.
- Confirm the prompts.
The exact wording can vary by Windows version, but the goal is the same: start the uninstall from the installed-app list.
If Windows displays “Could not set file security for file” and names a file under `D:\Config.Msi`, stop and write down the full path. Then check whether D: is available and whether your account can access that folder.
Try the Settings uninstall one more time only after fixing an obvious issue, such as reconnecting the drive or signing in with an administrator account. Repeating the same failed action will not repair a missing installation path.
If you are trying to remove a different program, use the same Apps screen and select that program instead. The Error 5 behavior is not limited to Python.
Try Control Panel when Settings cannot remove Python
Windows also keeps the older uninstall list in Control Panel. It may use a different route to the same Windows Installer information, so it is worth trying if Settings fails.
- Open the Start menu.
- Search for Control Panel and open it.
- Select Programs.
- Open Programs and Features.
- Select the Python entry.
- Click Uninstall or Change.
- Follow the prompts.
If the Python entry is not listed, do not start deleting folders at random. The installed files and the uninstall record may no longer agree, or the original installer location may be unavailable.
If Control Panel shows the same D: path and Error 5, that points more strongly to the old installation location or its permissions. It does not mean that Control Panel can force the program off the computer safely.
This also answers a common question: how to force uninstall a program you cannot uninstall. The safer first steps are to use both normal Windows uninstall paths, confirm the drive named in the error, and check access to the affected folder. There is no single forced-removal command that can be treated as a guaranteed fix for every Error 5 case.
Check the affected file or folder’s Security and Permissions settings
Only check permissions on the path shown in the error. If the message names `D:\Config.Msi`, inspect that location rather than changing permissions on the entire C: drive or on broad system folders.
Check basic permissions
- Open File Explorer.
- Browse to the affected drive and folder.
- Right-click the file or folder.
- Select Properties.
- Open the Security tab.
- Select your Windows account, or the group it belongs to.
- Review the permissions shown below.
You are checking whether the account can access the folder and whether Windows is denying actions needed by the installer. Do not grant every permission automatically. Read the existing entries first.
If the folder cannot be opened, or the Security tab shows that your account has no useful access, ask the device administrator to review it. On a work or school computer, those restrictions may be deliberate.
Use Advanced settings carefully
The Advanced button shows more detail, including permission entries and the folder owner. Windows may refer to these entries as access control entries. They are rules that say which accounts can use or change the folder.
Changing ownership can sometimes allow an administrator to review or repair access. It is not a universal fix, though. It can also change protections that other installer tasks depend on.
Before changing anything:
- Confirm the drive and folder match the error exactly.
- Record the current owner and permission entries.
- Avoid changing permissions on an entire drive.
- Do not remove entries just because they look unfamiliar.
- Create a recovery option, such as a restore point, if that is available on the computer.
One reported Windows installation failure involved taking ownership of an Installer folder and removing two DACL entries. A DACL is the list of rules that controls who can access a folder. That report does not make the same change safe for every computer or every `Config.Msi` error. Treat it as a case-specific repair, not a standard instruction.
After checking or carefully repairing access, retry the uninstall from Settings or Control Panel. If Error 5 returns, undoing or adding more permission changes may create more confusion. Move to the next decision point instead.
What to do when the original drive or installation location is unavailable
A missing drive changes the problem. Windows may be unable to complete the uninstall because the installer needs files from the original location.
If the drive is supposed to exist, try the least risky fixes first:
- Reconnect the external drive.
- Check whether it appears in This PC.
- Make sure the drive uses the same letter shown in the error.
- Reconnect a network location if that was the original path.
- Ask the computer administrator whether the drive was renamed or removed.
If the drive is present but the folder is missing, check the full path again. `D:\Config.Msi` is different from another installer folder on a different drive.
If the drive is permanently unavailable, the normal uninstall may continue to fail. At that point, avoid guessing with registry edits, random deletion, or commands copied from unrelated permission problems. The uninstall record may need to be repaired using a supported Windows recovery method or handled by someone who can restore the original installation source.
This is also where installation and uninstallation often get mixed up. If you are trying to install `python.exe` or looking for a Python download, that is a separate task. The Error 5 reports covered here mainly involve removing an existing Python installation. Do not use an uninstall error as an installation guide, and do not remove installer files while trying to install Python.
When to stop changing permissions and use a safer recovery path
Stop editing permissions when:
- The error keeps naming a drive that no longer exists.
- You are unsure which folder is the real installation location.
- The folder belongs to Windows Installer or another system component.
- You would need to remove several unknown security entries.
- The computer is managed by work or school policies.
- The uninstall fails in both Settings and Control Panel after an administrator has tried it.
At that point, keep the exact error text and path, including any `.rbf` filename. That information helps identify whether the failure is tied to Python, another program, or an unavailable installation drive.
The safest path is to verify the affected drive first, inspect permissions only on the named file or folder, and then use the appropriate Windows uninstall route. Don’t delete `Config.Msi`, registry entries, or broad system folders blindly. Start with the path Windows actually reported, and change nothing until you know which installation it belongs to.