Helping people with computers... one answer at a time.

The host file is a good tool to use to block IP addresses to keep your computer safe from porn and more. You must have administrative privileges to make changes. I'll show how to set those privileges.

Hey, Leo, I'm attempting to add known porn sites to my host file assigning the domain to them. However, every time I try to save the entry through Notepad, I get the message that I don't have the authority to do that and that I should check with the administrator. Of course, that's me and I'm already running Explorer as the administrator. So why can I not make the changes and what do I need to do so that the changes to my host file are saved and take effect?

In this excerpt from "Answercast #8, I discuss how the host file can help protect your computer and a few extra steps necessary (from Windows Vista and up) to run Notepad as administrator.

You are not administrator... yet.

Using the host file to block certain domains is actually a very convenient way to do domain blocking at a per machine level. The host file is where your system goes to to look for the IP addresses associated with a domain name. By forcing the IP address to be, you're saying that that domain actually resides on your machine and of course, it does not. Your machine isn't even running a web server.

As a result, the web browser (or any other attempt to get to that domain) fails. It's perfect for blocking porn sites or anything else that you're interested in blocking.

Administrative access to Notepad

The host file is protected. You must have administrative privileges to run it. And, as it turns out, it's not uncommon to think you have administrator privileges when you don't.

I'll point you to an article on the site: "Why does my computer say I need to be administrator when I am?"

In reality, you may think you're administrator, but you're not.

Windows security

One of the security features introduced in Windows Vista and carried forward in Windows 7 is that even an account that has been assigned administrative privileges is not running as administrator. What you need to do in a case like this is run Notepad specifically as administrator.

What that means is that you right-click on the Notepad icon. A pop-up menu should then have something that says, "Run as administrator." Click on that.

You'll probably have to confirm a Windows User Access Control prompt, confirming that in fact you are running it as administrator. Once you do that, you can use "File Open" to access the host file. Make your changes and at that point, you should be able to save it without any problems.

Next -Why can't I log into Hotmail even though I remember my password?

Article C5192 - April 11, 2012 « »

Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

April 11, 2012 8:41 PM

Leo, just tried your Administrator tip in Notepad, but it didn't work. After I checked the Administrator icon and added a password it rejected it. Any ideas?

"Added" a password? I have no idea then what you actually did - there's no need to add a password. Just right click on the notepad icon, click on Run as administrator, and you should be able to edit the hosts file.
April 13, 2012 8:49 AM

The host file is usually read only. Use your favorite method to clear it. Make your changes. Save it and then recheck the read only attributes .

May 3, 2012 3:52 AM


Cheers bro, worked a treat. I will remember this one for next time!

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to to ask your question.