Editing the HOSTS File in Vista…

There are many reasons you’d want to permanently remap IP addresses and hostnames on your computer by editing its HOSTS file, the most common being to prevent access to harmful websites.

Hosts Access DeniedSometimes, however, the reason is more benign; a local web application won’t allow itself to be run by visiting http://localhost or http://127.0.0.1 — like a development version of WordPress I’m trying to install. [Wow, imagine that! I'm trying to do development on something other than my main production machine!]

Anyway, with their latest Vista non-operating system, Microsoft has decided that you do not need to edit the file, telling you instead after an attempted edit that “Access to C:\Windows\System32\drivers\etc\hosts was denied.”

Ha!

Right-click Notepad, and select the “Run as administrator” option. Now simply open the HOSTS file with Notepad (the file’s still in the C:\Windows\System32\drivers\etc\ folder). This time when you save your changes, there will not be an access-denied message.

All done!

If you liked this, you might also be interested in:

Responses

One Response to “Editing the HOSTS File in Vista…”

  1. Response #1
    Michael Ageeb (IP) on March 22nd, 2008 at 9:28 am

    Well the case isn’t only with the hosts file.
    Windows will require you to explicity login with the machine admin account to be able to edit these kind of system wide configuration files in Windows.

    Same case as the hosts file in Linux you need “sudo vim /etc/hosts” and the sudoers file you can’t just edit it you need to use “sudo visudo”

    Thanks

Contribute to the Conversation: