I’m very familiar with 127.0.0.1 – the network address that I’ve actually
managed to use to make it harder for me to get on to some of the websites that
I find a little bit too addictive. Now, I’ve gotten it to work on my XP desktop
but I can’t get it to work on my Windows 7 laptop. I’ve learned how to use
Notepad to edit the file but I’ve not been able to get it to stick. Hope you
can help me.
In this excerpt from
Answercast #89, I look at changes in Windows 7 that protect the hosts file
from being edited unless you specifically run Notepad as administrator.
]]>
<
The hosts file is often set to read-only (either by anti-malware programs, or by Windows itself), which would prevent even a “run as administrator” program from overwriting it. (The file may even be set to “system” and/or “hidden”.)
What I do is start an administrator command prompt (just like your administrator notepad, but for “command prompt” instead), and type:
(Make note of the attributes)
(Use “+r”, “+s”, and/or “+h”, depending on original attribs.)
Microsoft Security Essentials doesn’t like you modifying the hosts file from the original. It will erase all your changes.
The only way around is to create an exception but then it won’t scan it for changes that are made since you made the last known changes. Frustrating.
22-Jan-2013
Now I’m totally confused. Do you “want” sites listed in the hosts files, or you “don’t want” them listed?
i just opened mine and there are a great many sites that I have never visited, nor ever will. How did they get there, and is that a good or bad thing?
You *may* want sites listed there if you’re attempting to prevent access to those sites. Those would have addresses of 127.0.0.1. It’s a common technique that some anti-spyware tools use – they put known bad sites in a list here to prevent you from ever accidentally going there. Some ad blockers also use this technique.
You *may not* want sites listed there that are being directed to some other address. For example malware can put things there that could cause you to visit their server when you, for example, think you’re visiting paypal.com (or google.com or who knows what else). Good anti-malware tools should check for this.
22-Jan-2013
Bob Price,
That’s worrisome. I would think that, generally, you don’t want sites listed in the hosts file as each listing is a redirect. Especially if you didn’t put them there!
I’m a web designer and I use the Hosts file all the time when I am making DNS changes (like registering a new domain.) Generally the hosts file has nothing in it except instructions.
What you can do is put a # (pound sign) at the beginning of each line and save the file, then see if things run normally. Back up the file first, and ideally backup the whole computer.
Might be time for a deep malware look!
Thanks, Connie, so why not just delete every entry? And I frequently run about six differernt malware, spybot, and virus problems, one at a time.
More: adding an * is fine, but there are a gigantic number of lines–it would take hours. Why not rename host to host-old, reboot, and see what happens.? I really thought i understood the purpose of the host file, but now see that I’m clueless.
Confusion continues: other sites say adding a server will actually block access, so I want bad sites listed, right?
“If you put ad server names into your Hosts file with your own computer’s IP address, your computer will never be able to contact the ad server. It will try to, but it will be simply calling itself and get a “busy signal” of sorts.”
An excellent hosts editing program is HostsMan, freeware, available at http://www.abelhadigital.com/hostsman. Do check it out.
Sometimes the notepad method doesn’t work because your anti virus will still not give you easy access to it. So you can usually edit it in safe mode if all else fails.
Bob Price… Let me add some emphasis to the item you quoted:
“If you put ad server names into your Hosts file with your own computer’s IP address, your computer will never be able to contact the ad server.”
Note that “127.0.0.1” is always “this computer”.