Why can’t I edit the hosts file, even as Administrator?

Bud I March 18, 2014
Whatsapp Pinterest

[Ed: this is a follow-on from How can I enable the built-in Administrator account in Windows 7?]

I have enabled the hidden Administrator user. However, if I log on as Administrator, use Notepad to revise
/Windows/System32/Drivers/Etc/Hosts and try to save it, I still get an error message saying I don’t have the authority to save that file. What is the next step?

  1. Marvin Hollander
    March 26, 2014 at 6:36 pm

    Can you delete the file? If you can, please do so. Then make a new hosts file. then you should be able to edit the file.

  2. Adam C
    March 19, 2014 at 2:32 am

    Jan F's answer should get you squared away but, I think that there is a much simpler way to accomplish this.

    1st. Run your text editor of choice as administrator (do the right-click, run as admin dance)
    2nd. Open your hosts file should be in here: "%systemroot%system32driversetc"
    3rd. Modify to your hearts desire, don't forget to save...

    I just tried this successfully with np++ and notepad.

    • Jan F
      March 19, 2014 at 5:14 pm

      That's interesting tho – I didn't recommend this method as np++ wouldn't show the "etc" folder and notepad.exe wouldn't show the contents of the "etc" folder on my end.

      oh well, it's Windows, right?

    • Adam C
      March 19, 2014 at 8:38 pm

      Jan F, does np++ work if you type the whole path into the open file dialogue? Also with notepad.exe what I had to do was change the option that limited the results to just .txt files. Sorry to beat a dead horse, but I was just curious.

  3. Jan F
    March 18, 2014 at 7:50 pm

    You shouldn't have to do any of it:
    - enabling and logging in as the administrator
    - modify the security settings (permissions) on the file or the parent folder
    - modify the UAC setting

    And I also suggest not to do any of it. The hosts files is affected by multiple security options. It's a protected system file, it's a hidden system file and it can only be modified by the administrator.

    The easiest method to modify it:
    copy the hosts file to your desktop, modify it with your preferred editor
    drag&drop your modified version into the original location and confirm to overwrite it

    option 2, right-click on your Desktop, select New > Shortcut
    copy and paste the following line into the location field:
    C:WindowsSystem32notepad.exe "C:WindowsSystem32driversetchosts"
    now when you want to modify the hosts file right-click and "Run as administrator" on this new shortcut

    • Jan F
      March 18, 2014 at 7:54 pm

      Oops, it is of course not a hidden system file but it's parent folder is system protected and only modifiable by administrative accounts.

    • Bud I
      March 19, 2014 at 4:00 am

      Jan F. - Thanks! You broke the dam wide open. I have successfully updated the hosts file. I now notice Adam C's suggestion appears even easier.

      Thanks to all of you for pulling me out of this quagmire of system/security code.

  4. Bud I
    March 18, 2014 at 3:43 pm

    Dark Cloud!! ! I was hoping that would do it, but NO.

    Both the Read Only and the Hidden boxes were clear. The Administrators has all permissions checked except Special.

    • Hovsep A
      March 18, 2014 at 4:14 pm

      maybe your antimalware solution is doing this problem, disable it for a while in order to see if this will let you to edit hosts file.

      try to boot to safe mode and see if you can edit hosts file.

      can be UAC problem, disable it for dew minutes.

  5. Oron J
    March 18, 2014 at 12:58 pm

    Open the ...etc folder, right click on the hosts file and choose properties. Check that the file is not read-only (if it is, untick the option), then click on the /Security tab and check what permissions are in place. As an administrator, you should be able to change the permissions if necessary (just be carefull not to remove your own permissions!).

Ads by Google