Permission Denied on Hosts File (Windows 7)

On Windows 7, I was trying to edit the host file using Komodo and was getting Permission Denied, and tried notepad too still got permission denied. I thought initially it was McAfee Anti Virus that was disabling the edit of host file as this file is an important system configuration file.

The reason but was that Windows requires the editor to run with administrator privileges to edit the file, this is different in Windows XP because all programs by default used to run as Administrator if your were an administrator. The feature in Windows 7 is good as it helps protect against most mallicious software which when run as administrator can cause havoc.

So inorder to edit hosts file on Windows 7 , Goto Start Menu > Enter Notepad > Right-Click on Notepad > Run as administrator .

Now you can open the hosts file and edit it.

:) 08 Mar, 2010
Comments (5)
  • it is impossible! i ran cmd elevated, ran notepad as admin i can open the hosts file but it will save it as a .txt file so it isnt really replacing the real hosts file!

    By ruben on 19 Apr, 2012
  • easyphp permissions issue

    easyphp has a virtualhost manager... completely unusable cuz of the permissions issue. there a fix for that?

    By wza on 11 Dec, 2011
  • I get the same permission

    I get the same permission denied error using Komodo 6 on Windows XP running as an administrator user; however, no error when using Notepad.

    I thought it might be something to do with either Windows or my antivirus software protecting the hosts file from unauthorised changes but it only seems to be a problem when using Komodo and no other editor.

    I even tried "Run as..." and unchecking "Protect my computer and data from unauthorized program activity.

    By Mark on 25 Feb, 2011
  • still didnt work for me

    still didnt work for me

    By Anonymous on 04 Jul, 2010
    • double check, is read only enabled ?

      right click the host file, go to properties. see if read only is checked. if so, uncheck it. then perform edits to the host file. after you are finished, make sure to go back to the properties of the file and re-check the "read only" option. this is to protect the host file from being unwantingly changed.

      By unDies on 10 Jul, 2010
You may also like
On Facebook
Email Newsletter