How to Lock and Edit Hosts File in Windows 7 & 8

Posted by Britt Duncan - July 23, 2014

Maybe a lot of computer users don’t know about hosts file which is used to map host name to IP address. Usually, hosts file is placed in the Windows folder. Today in this Windows tutorial, we will show you how to find locate the hosts file. Besides, we also teach you how to protect the hosts file from being hijacked by some malicious programs or viruses.

It is very easy to locate the hosts file.
Here is its location: C:\Windows\System32\drivers\etc
hosts file1

How to lock Hosts file?

Usually, we wonder that how some malware and browser hijackers can redirect you to suspicious websites from your current website. The simple truth is that they hijack your hosts file and make modification. Therefore, in order to prevent hosts file is hijacked, you can turn the hosts file into a read only file.

Right click the hosts file and select Properties.
And check the check-box of Read only.
read only
By doing so, the locked hosts file can’t be modified by any malware and browser hijacker viruses.

How to edit Hosts file?

Locate the hosts file in Windows folder. Double click the hosts file and select Notepad to open it. Then you can add new data to the file.

Sometimes, you may receive an error message saying that “Access to C:\Windows\System32\drivers\etc\ hosts was denied” or “Cannot create the C:\Windows\System32\drivers\etc\hosts file. Make sure that the path and file name are correct.

hosts file

Faced with this situation, you need to open Start Menu and enter Notepad to search box. And right click the Notepad result. Select Run as administrator. Then open Hosts file and make necessary modification.

The Previous:
The Next:

Comments are closed.


TESTED:  21 Feb