Windows 8 and 8.1 Forums


Can't edit hosts file due to administrator rights

  1. #1


    Posts : 28
    Windows 8.1 x64 Pro

    Can't edit hosts file due to administrator rights


    I am getting error "Save failed - Please check if this file is opened in another program" when trying to edit the hosts file in Notepad++. This has only started happening after a fresh installation of Windows 8 on a new computer. My previous computer with Windows 8.1 was able to do it correctly without any errors. I am using only one account on both computers, but for some reason on the new computer, the UAC keeps getting in the way. I have lowered the UAC warnings all the way down but that hasn't helped. Is there another setting I'm missing?

    Note that I don't want to right-click Notepad++ and choose "Run as administrator" every time I want to edit a system file. I see that as a waste of time and an unnecessary step since I am already using an administrator account. I didn't have to do that on the old computer.

      My System SpecsSystem Spec

  2. #2


    A Finnish ex-pat in Leipzig, Germany
    Posts : 1,452
    Windows 8.1 Pro with Media Center


    Quote Originally Posted by Knocks View Post
    Note that I don't want to right-click Notepad++ and choose "Run as administrator" every time I want to edit a system file. I see that as a waste of time and an unnecessary step since I am already using an administrator account. I didn't have to do that on the old computer.
    It is totally irrelevant if you want to run the editor as administrator or not. You do either that, or you take full ownership of the Hosts file. Taking ownership of system files is not recommended but as it is your PC, you do whatever you want to. Basically you only have these two options, take ownership or run the editor as administrator.

    As a built-in security measure, Windows does not allow user saving to system folders by default.

    Take Ownership of a File, Folder, Drive, or Registry Key in Windows 8

    Kari
      My System SpecsSystem Spec

  3. #3


    Posts : 28
    Windows 8.1 x64 Pro


    Again, I did not do any of this on my old computer. I disabled UAC, and that was the end of the prompts and the errors.

    And generally, if you are already running the entire OS as an administrator, is it not redundant to take ownership of individual files or folders? Is this not the equivalent of logging in as root (sudo) in Linux?
      My System SpecsSystem Spec

  4. #4


    A Finnish ex-pat in Leipzig, Germany
    Posts : 1,452
    Windows 8.1 Pro with Media Center


    There's a big difference in between an administrative user account and Windows built-in administrator account. Only a local administrator user has right to elevate a command to use built-in administrator rights, that's why Windows needs at least one local administrator account. When you run a program as administrator (elevate it), it is not run using your local administrator rights but instead, using your local rights the command can be elevated to use built-in administrator rights.

    I am not sure how you managed this on your old computer but usually that is not possible, by default you cannot save in system folders. Try to extract a zip file to Program Files folder or save a Word document in Windows folder, the result is the same: Access denied.

    Only workarounds are those two options I mentioned in my previous post.

    Kari
      My System SpecsSystem Spec

  5. #5


    Posts : 28
    Windows 8.1 x64 Pro


    I still have my old computer. Can you help me check the settings on it and replicate them?
      My System SpecsSystem Spec

  6. #6


    A Finnish ex-pat in Leipzig, Germany
    Posts : 1,452
    Windows 8.1 Pro with Media Center


    First: on your old computer, check who / what is the owner of the Hosts file:

    Click image for larger version
    (Click to enlarge.)

    If it's System as by default, then it might be that owner / permissions of one of the folders in the Hosts path (C:\Windows\System32\drivers\etc) has been changed and inherited by subfolders.
      My System SpecsSystem Spec

  7. #7


    Posts : 28
    Windows 8.1 x64 Pro


    Hi. I checked the settings, and the owner of that file is my administrator account, as opposed to SYSTEM. But I don't think I had ever set the ownership for that file.
      My System SpecsSystem Spec

  8. #8


    A Finnish ex-pat in Leipzig, Germany
    Posts : 1,452
    Windows 8.1 Pro with Media Center


    How old is your old computer? I mean, are you sure you have not either edited the permissions and owner, or for instance created a new Hosts file to another location and then copied it over the original? If you for instance create a new Hosts file, save it to desktop, and then replace the original in C:\Windows\System32\drivers\etc with your new one, it is no longer owned by System.

    The same if you copy the original Hosts, then replace it with you copy.
      My System SpecsSystem Spec

  9. #9


    Posts : 28
    Windows 8.1 x64 Pro


    You're right, I have no idea, because it was a long time ago. I replaced the hosts file on my new computer with a newly created duplicate and now have full permissions to it. Thanks for the help.

    A related question. I have a banking app with a shortcut on the desktop. The shortcut requires elevated privileges on the new computer, for some reason, and has a shield icon imposed on top of the regular icon. On the old computer, it's just a normal shortcut. I'm pretty sure I used the same installation file for both. How can I make this shortcut "normal" on the new PC?
      My System SpecsSystem Spec

  10. #10


    A Finnish ex-pat in Leipzig, Germany
    Posts : 1,452
    Windows 8.1 Pro with Media Center


    I think the easiest would be to accept the enhanced security (elevated shortcut) but instead of using the old shortcut which prompts UAC, create a new one as told in this tutorial: Elevated Program Shortcut without UAC Prompt - Create - Windows 7 Help Forums

    Tutorial is for Windows 7 at our sister forums but the procedure is the same in Windows 8.
      My System SpecsSystem Spec

Can't edit hosts file due to administrator rights
Related Threads
I've got a strange problem running 7-Zip 9.28 alpha under Windows 8 Pro x64 RTM. Hope you can help. In order to be able to click on a zip file and then extract it's contents to a folder I have to set 7zFM.exe to run with Administrator rights via Properties | Compatibility. However, when...
Solved try to save the hosts file in General Support
Thanks for sharing these instructions, which I followed to the letter and added the "Take ownership". I use the new menu on the Windows/System32/drivers/etc folder. Notwithstanding, as I try to save the hosts file on Windows/System32/drivers/etc it responds "Denied access" and does not allow to...
administrator rights in General Support
First of all my computer skills are just average. Sometimes when doing certain things. It says I need administrator rights. ( Windows 8 ) Whats the easiest way to do this? Also the things I heard on ( You Tube ) is not to leave administrator rights allways on. Hackers will mess with...
Win 8.1 Pro x64, single-user computer. I don't know if it started with updating from 8 to 8.1 in December, but roughly since then I've getting been a fair number of error messages while saving or changing a program's default setting, saying directly or indirectly that I need administrator rights...
Solved Administrator rights for software in Standard account in User Accounts and Family Safety
Hi, I'm currently using Windows 8.0. Would like to check if it is possible to allow a particular software to be run as Administrator, even when I am using a "standard account", without the need to enter the administrator password everytime I open it? Essentially like making an exception to allow...
Changing Hosts File in General Support
I am trying to edit my host file, but the system is telling me that I need to be an administrator, when I am the administrator. I made an attachment in word with screen shot for you to see. Is there a solution for this problem? 25078
lost all administrator rights... in User Accounts and Family Safety
A couple of days ago i noticed that my C: Drive doesnt have its usual name and i cant access it, now its just Local Disk C. the PC work fine, except for the fact that i cant install anything, or open anything that requires admin rights. I cant perform a factory reset from the "advanced tools" menu,...
Eight Forums Android App Eight Forums IOS App Follow us on Facebook