Simple Ideas To Learn How To Code
Hosts File in Windows
Windows

Hosts File in Windows

The Hosts file in Windows, is used to map host names to IP addresses and Hosts file is located in the Windows folder. It is basically a plain text file and the size of the default Hosts file is about 824 bytes.

Where is Hosts File in Windows Located?

In this post, we will see its location and also how to manage, lock or edit the Hosts file.

Host file location

The Hosts file in Windows is located at the following location:

C:\Windows\System32\drivers\etc

Lock Hosts file to prevent hijacking

Imagine clicking on www.yourdomain.com and seeing a completely different web site load in your browser. Malware can redirect Web addresses on your computer by altering your hosts file and is referred as the Host File Hijack.

To prevent Host file hijacks, you may navigate to it and right-click on it, select Properties and make it a Read only file. This will lock down your Hosts file and prevent any malware from writing to it.

How to Block website using Hosts file?

To block a website using the Hosts File, simply add the following entry:

127.0.0.1       blocksite.com

Simply, add entries to hosts file in order to block opening of one or more particular websites.

How to Edit Hosts file?

If you need to edit the Hosts file, navigate to the following folder location:

C:\Windows\System32\drivers\etc\

Here you will see the Hosts file. Right-click on it and select Notepad. Make the changes and Save.

But sometimes, even when you are logged on with administrative credentials, you may recieve the following error message:

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.

In this case, type Notepad in start search and righ-click on the Notepad result. Select Run as administrator. Open the Hosts file, make the necessary changes, and then click Save.

Leave a Reply

Your email address will not be published. Required fields are marked *