Problem modifying hosts file, change file permissions?


  1. Posts : 4
    Windows 7 Home Premium, 64 bit
       #1

    Problem modifying hosts file, change file permissions?


    Hi all,win7 Home Premium 64 bit. I'm having difficulties modifying my hosts file. Following guidance from this forum, I open Notepad++ as administrator & can navigate to and open the hosts file. But the "Save" option is greyed out, so I can't save directly to the original location. I can Save As (eg to the Desktop), then copy paste into the original location.
    This is actually part of a larger troubleshooting issue, in which the person helping has suggested changing the file permissions on the hosts file. I'm worried about doing that, as it seems quite a security risk. But the immediate question is, is the behavious of my hosts file unusual, or is that how Windows 7 is meant to work?</p>
      My Computer


  2. Posts : 5,642
    Windows 10 Pro (x64)
       #2

    Drag the file to your desktop, edit and save then drag it back. Done. This is how it should work, you want strong permissions on those directories and files to avoid malware from modifying them.
      My Computer


  3. Posts : 4
    Windows 7 Home Premium, 64 bit
    Thread Starter
       #3

    Hi logicearth, and thanks for responding.
    I'm aware that I can drag & drop the hosts file after modification, and indeed referenced the same in my OP. I also said in my OP that this is part of a larger troubleshooting issue, in which the inability to modify the hosts file as administrator has been cited as the reaon why a program is not running properly.
    The suggested solution is to change permissions on the hosts file, which I am unhappy about. What I'm not clear about - and the question in my OP - was whether what I am seeing is normal behavious for the hosts file, or whether in fact this is not normal, some process has locked the hosts file, and it is appropriate to change its permissions to reverse the process.
      My Computer


  4. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #4

    Hey there Kapalu,

    kapalu said:
    But the immediate question is, is the behavious of my hosts file unusual, or is that how Windows 7 is meant to work?</p>
    Is this hosts file we're referring to located in C:\Windows\System32\drivers\etc? If so, you're certainly experiencing unusual behaviour, for any elevated process should have full-control access over this file.

    Are you confident that the permissions on this hosts file of yours is set correctly?

    If you would like us to check, in a Command Prompt run the command,
    Code:
    icacls C:\Windows\system32\drivers\etc\hosts
    and post back the result.
      My Computer


  5. Posts : 4
    Windows 7 Home Premium, 64 bit
    Thread Starter
       #5

    Hi Pyprohly,

    Yes, thats the hosts file in question.

    I ran the icalcs command and this is the result:

    C:\Windows\system32\drivers\etc\hosts BUILTIN\Users:F)
    NT AUTHORITY\SYSTEM:I)(F)
    BUILTIN\Administrators:I)(F)
    BUILTIN\Users:I)(RX)

    Successfully processed 1 files; Failed processing 0 files
      My Computer


  6. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #6

    That's just about correct, except for the listed explict grant permission on the Users group (indicated by BUILTIN\Users:(F)) which isn't supposed to be there. Did you end up granting that permission yourself?

    BUILTIN\Users:(F) means that all users (on the local machine) have full-control over this file (talk about worrying about security risks), so you should have absolutely no problems editing this hosts file.

    Are you sure Notepad++ is not letting you Save?? Does Ctrl+S do anything?

    The issue you have does not A) relate to permissions, or B) is caused by another process locking the file (Notepad++ would state otherwise).

    Try editing this hosts file using Windows Notepad / another text editing program. If that works, consider uninstalling and reinstalling Notepad++.
      My Computer


  7. Posts : 4
    Windows 7 Home Premium, 64 bit
    Thread Starter
       #7

    OK, tried opening the hosts file with Notepad2 - and it opens and saves just fine. So it seems I have a local problem with my copy of Notepad++. How frustrating, I wish I'd thought to check that earlier.

    That leaves 2 issues I guess:
    1) PERMISSSIONS - I'm not aware of having granting permissions to the Users Group (BUILTIN\Users:F)). Please could you tell me how I can reverse this?

    2) Since Notepad2 can save the hosts file, that indicates that the problem is NOT related to Permissions, and also NOT to another process blocking the file? Is that right?

    Thanks very much for taking the time to help me out with this
      My Computer


  8. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #8

    kapalu said:
    OK, tried opening the hosts file with Notepad2 - and it opens and saves just fine. So it seems I have a local problem with my copy of Notepad++. How frustrating, I wish I'd thought to check that earlier.
    Yep. Sounds like an issue with the application, Notepad++.

    kapalu said:
    I'm not aware of having granting permissions to the Users Group (BUILTIN\Users:F)). Please could you tell me how I can reverse this?
    Simply remove the non-inherited listed entry of the Users group on the hosts file from the GUI. Or you may instead just choose to run the command
    Code:
    icacls C:\Windows\System32\drivers\etc\hosts /remove Users
    kapalu said:
    Since Notepad2 can save the hosts file, that indicates that the problem is NOT related to Permissions, and also NOT to another process blocking the file? Is that right?
    That's right. Notepad2 being able to save to the hosts file would suggest that both of those possible problems are not the issue.

    kapalu said:
    Thanks very much for taking the time to help me out with this
    Your welcome. Glad the issue was identified.

    And welcome to SevenForums too, Kapalu.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 00:32.
Find Us