Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Problem modifying hosts file, change file permissions?

23 Mar 2015   #1
kapalu

Windows 7 Home Premium, 64 bit
 
 
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 System SpecsSystem Spec
.
23 Mar 2015   #2
logicearth

Windows 10 Pro (x64)
 
 

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 System SpecsSystem Spec
24 Mar 2015   #3
kapalu

Windows 7 Home Premium, 64 bit
 
 

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 System SpecsSystem Spec
.

24 Mar 2015   #4
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hey there Kapalu,

Quote   Quote: Originally Posted by kapalu View Post
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 System SpecsSystem Spec
24 Mar 2015   #5
kapalu

Windows 7 Home Premium, 64 bit
 
 

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 System SpecsSystem Spec
24 Mar 2015   #6
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

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 System SpecsSystem Spec
24 Mar 2015   #7
kapalu

Windows 7 Home Premium, 64 bit
 
 

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 System SpecsSystem Spec
24 Mar 2015   #8
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Quote   Quote: Originally Posted by kapalu View Post
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++.

Quote   Quote: Originally Posted by kapalu View Post
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
Quote   Quote: Originally Posted by kapalu View Post
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.

Quote   Quote: Originally Posted by kapalu View Post
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 System SpecsSystem Spec
Reply

 Problem modifying hosts file, change file permissions?




Thread Tools




Similar help and support threads
Thread Forum
Unexplained change in file permissions
Hi I wonder if anyone has come across this problem and can offer any suggestions. I keep copies of much of my music collection on an external HD and until a week ago everything was working fine. Last week when I booted up my machine and went to play some music I discovered that somehow the...
Music, Pictures & Video
problem hosts file
Hello, I am hosting a weberver on a windows 7 pc. It's ip address: 192.168.0.100 Mijn domainname is: (example) www.mysite.nl If i type from another pc on my local network in the url of the browser: www.mysite.nl, he can not find the indexpage of the webserver I have to type my local...
Network & Sharing
Hosts file editing: save problem
My Hosts file was lost so I downloaded a new one. This I edited to block two sites that had intruded and given trouble. I saved initially to desktop and then tried to paste and save it in to C:\windows\.......\etc , but failed to do so as error as per att, appeared, I am a sole user/...
General Discussion
HOSTS File - Create a "Edit HOSTS file" Shortcut
How to Create a "Edit HOSTS file" Shortcut in Windows 7 and Vista The HOSTS file is a .txt file used in Vista and Windows 7 to map hostnames to IP addresses. Your computer checks this file first to resolve any network names to its corresponding IP address before it tries to check the Internet....
Tutorials


Our Sites

Site Links

About Us

Find 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 04:50.
Twitter Facebook Google+