Solving Unable to Edit Host File in Windows 10

A host file is used to resolve host names to the relevant IP addresses, just like on a traditional DNS server. Since the host file is executed before the system accesses the DNS server, it’s widely used to block, redirect or guide certain hostnames. However, by default, this file can’t be edited. This article sheds light on exactly this point and explains a couple of solutions on how to make appropriate changes to make this file editable. You can, in the meanwhile, download ST Cleaner and scan your PC for junk files and speed bottlenecks.

Speed up Windows 10, Make it Stable with ST Cleaner

Your download is secured and from official website (no bundled applications are installed, we hate that!)

 

Solutions

Before proceeding ahead, it’s important to note that both of the following solutions are only for those users who have sufficient administrative rights on the computer as it’s not possible to edit a system file without admin rights.

 

Solution 1: Change The Ownership and The Permission of the File

This method is a bit tricky and possibly a bit dangerous too as it makes the file vulnerable to non-admin attacks. This can culminate in the execution of a virus/ malware in the standard permission mode, which can result in modification of the file to redirect the user to a malicious website instead of the real one. As an example, the IP address of PayPal is 64.4.248.8, but if the virus modifies the system to resolve paypal.com to a different IP where the malicious website is hosted, the user is redirected to a fake site instead of the actual PayPal site. So it’s important to change the permission back to the default state once the process is over.

  1. Visit the following folder location, and locate hosts file:
    C:\Windows\System32\drivers\etc
    image00
  2. Right-click on it and select Properties.
Selecting Properties
Selecting Properties
  • In the Properties window, locate the Security tab and click it.
    image01
  • Locate the Advanced button on the bottom of the window, click it.

    Clicking Advanced
    Clicking Advanced
  • In front of the Owner label, you will see the Change button. Click it to change the file’s ownership.
    image03
  • Type the email address of the currently logged in user account. In Windows 10, usually it asks to type the email address of the user when the first user account is being created.
    image06
  • Click on Check Names to initiate the search.

    Click Check Names
    Click Check Names
  • Then it will change the email address to its associated Name + Email. Click OK to set this user as the file’s owner.
    image08
  • Scroll down a bit, locate the Permission tab and click it. Find the currently logged in user account and select to highlight it.

    Highlight the user account
    Highlight the user account
  • Click on Edit.
    image11
  • Select Allow from the dropdown box. Also, select all the checkboxes under Basic Permissions.image09
  • Click OK.
  • Once the permission has been changed, the Access column of the currently logged in user will show Full Control, implying the user has full control over the file. Make sure there is no other user currently logged-in on the table. As an example, there should be only Badde Liyanage Don Dilanga account in the table, because if there is another account logged in at the same time with a different permission level, it will override the below permission level.  Click OK to exit.
    image12
  • Make sure in the Properties window, the user has full control over the file so that they can easily modify it.

    Make sure that the user has enough privileges to edit the file
    Make sure that the user has enough privileges to edit the file
  • Click OK to save the changes.
  • Search for Notepad in the start menu and then open it from the Search Results.

    Opening Notepad
    Opening Notepad
  • Drag and drop the hosts file to the Notepad window.

    Drag and drop the hosts file
    Drag and drop the hosts file
  • Now start editing the file. Do not forget to save it before closing.

 

Solution 2: Edit The Host File Outside of the System Folder

This solution is ideal for those who don’t want to go through all the steps of Solution 1. This solution is also helpful if the host file is modified quite rarely.

  1. Visit the following folder location:
    C:\Windows\System32\drivers\etc
  2. Drag and drop the file to the desktop as seen in the following screenshot.
    image17
  3. Now start editing the file. Once you’re done copy it back to its original location.