FIX: ‘Access denied’ when editing hosts file on Windows 10

Fix error code 0xc004c003 in Windows 10

Sometimes in order to fix a certain problem or to block a certain website on your Windows 10 PC you have to edit hosts file. Editing hosts file is relatively advanced procedure, and number of users reported “Access denied” message while trying to edit hosts file on Windows 10.

Hosts file is located in your Windows 10 installation directory, and it’s protected from unauthorized access, but if you need to edit hosts file, you can avoid “Access denied” message by following one of our solutions.

How to edit hosts file on Windows 10 and avoid “Access denied” message?

Solution 1 – Run Notepad as administrator

If you use Notepad as your text editor, you need to run it as administrator before you can edit the hosts file. To run Notepad as administrator and to edit hosts file, do the following:

  1. Press Windows Key + S, enter Notepad. Right click Notepad from the list of results and choose Run as administrator.
    notepad-admin
  2. Once Notepad opens, choose File > Open.
  3. Navigate to C:\Windows\System32\drivers\etc folder and make sure to change Text Documents (*.txt) to All Files. Select hosts and click Open.
    hosts-open
  4. Make the changes you want and save them.

We have to mention that this solution should work with any other text editor, so if you don’t use Notepad, just run your desired text editor as administrator and you should be able to edit hosts file without any problems.

Alternatively, you can start Command Prompt as administrator and use it to start Notepad and edit the hosts file. To do that, follow these instructions:

  1. Press Windows Key + X and choose Command Prompt (Admin) from the menu.
    command-prompt-admin
  2. Once the Command Prompt opens, enter the following lines and press Enter after each line:
    • cd C:\Windows\System32\drivers\etc
    • notepad hosts
      cmd-notepad
  3. Notepad will now open hosts file, and you should be able to make the necessary changes.

Solution 2 – Copy the hosts file to a different location

According to users, you can avoid “Access denied” message while editing hosts file simply by moving the file to a different location, editing it and moving it back to the original location. To do that, follow these steps:

  1. Go to C:\Windows\System32\drivers\etc and locate hosts file.
  2. Copy it to your Desktop, or any other folder that you can easily access.
  3. Open the hosts file on your Desktop with Notepad or any other text editor.
  4. Make the necessary changes and move the hosts file back to C:\Windows\System32\drivers\etc directory.

Solution 3 – Make sure hosts isn’t set to Read-only

By default hosts file is set to Read-only which means that you can open it, but you cannot make any changes to it. In order to fix this issue, you need to turn off Read-only mode for hosts file by doing the following:

  1. Go to C:\Windows\System32\drivers\etc.
  2. Locate the hosts file, right click it and choose Properties from the menu.
  3. Go to Attributes section and make sure Read-only option isn’t checked.
    read-only
  4. Click Apply and OK to save changes.

Now you should be able to make the necessary changes to hosts file. After you’re finished, it might be a good idea to set hosts file back to Read-only mode again.

Solution 4 – Change the security settings for hosts

Sometimes in order to access certain files and folders, you need appropriate privileges, and the same goes for hosts file. If you’re getting “Access denied” while trying to change hosts file, you might not have full control over the file, but you can easily change that by following these steps:

For various PC problems, we recommend to use this tool.

This tool will repair most computer errors, protect you from file loss, malware, hardware failure and optimize your PC for maximum performance. Quickly fix PC issues and prevent others from happening with this software:

  1. Download ReimagePlus (100% safe download and endorsed by us).
  2. Click “Start Scan” to find Windows issues that could be causing PC problems.
  3. Click “Repair All” to fix all issues.

  1. Navigate to C:\Windows\System32\drivers\etc.
  2. Locate hosts file, right click it and choose Properties.
  3. Navigate to the Security tab and click Edit button.
    hosts-edit
  4. You should see the list of users and groups on your PC that have access to hosts file. If your user name or group is on the list, click it and make sure that it has Permissions set to Full control. If your user name isn’t on the list, click the Add button.
  5. Enter the user name or the group name in the Enter the object names to select field and click Check Names and OK.
    add-new-user
  6. New user or group will be added to the list. Now you need to select the newly added group or user and check the Full control option below.
  7. Click Apply and OK to save changes.

Solution 5 – Use the hidden administrator account

Most system files are protected, therefore you need an administrator account in order to make changes to them. Since hosts is one of the system files, it requires an administrator account in order to edit it. If you don’t use an administrator account, you can enable hidden administrator account and use it to make the changes to hosts file. To enable hidden administrator account, do the following:

  1. Press Windows Key + X and choose Command Prompt (Admin).
  2. When Command Prompt opens, enter net user administrator /active:yes and press Enter. This will activate the hidden administrator account.
    cmd-admininistrator-enable
  3. After you have activated the administrator account, you can switch to it, and try editing the hosts file.

After you made the changes to hosts file, you can come back to your original account, start Command Prompt as administrator again and enter net user administrator /active:no to disable the hidden administrator account.

Quick solution to fix various PC errors

  • Step 1: Download this PC Scan & Repair tool
  • Step 2: Click “Start Scan” to find Windows issues that could be causing ‘Access denied’ error in Windows 10
  • Step 3: Click “Start Repair” to fix all issues.

Hosts file is a system file, so it’s protected, and usually it’s not advised that you edit it, but if you decide to do so, it’s always good to know how to reset hosts file to default in Windows 10 in case anything goes wrong. In case you have to edit the hosts file, but you’re getting the “Access denied” message, feel free to try some of our solutions.

For various PC problems, we recommend to use this tool.

This tool will repair common computer errors, protect you from file loss, malware, hardware failure and optimize your PC for maximum performance. Quickly fix PC issues and prevent others from happening with this software:

  1. Download ReimagePlus (100% safe download).
  2. Click “Start Scan” to find Windows issues that could be causing PC problems.
  3. Click “Repair All” to fix all issues (requires upgrade).