Link to home
Start Free TrialLog in
Avatar of C Emmons
C EmmonsFlag for United States of America

asked on

Why can't I edit my Windows 10 Hosts file?

I'm implementing a new ADFS version -- testing is done by editing the local hosts file.  Users run Windows 10.  Some users can run as Administration using Notepad and edit c:\windows/system32/drivers/etc/hosts and save it.  Some absolutely cannot.  It looks like they should have permissions - based on effective permissions --but they get a permissions error.  We've tried 4 desktops running Windows 10 -- 2 worked easily -- 2 will not work.  What's the difference?  The user is an Administrator on the computer.  We stumped.
Avatar of Giovanni
Giovanni
Flag of United States of America image

Do you have antivirus software running which prevents writing to the HOSTS file?
Avatar of C Emmons

ASKER

Not that I'm aware of -- it's pushed out campus wide and should be the same fro everyone.  The people who 'work' should have the same anti-virus.
The builts of Windows 10 could possibility differ -- since everyone didn't get their computer from the same batch.  Could that be related.
Try running LockHunter or similar on the file and post your results.
ASKER CERTIFIED SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You must open Notepad with Run as Administrator (even if you are Administrator). Navigate to HOSTS. open, edit and save.
Install Notepad++ and open the file with it. It will ask you by saving the changes to run the program under administrator.
Also check to make sure that the file is not Read Only.

-saige-
I am using Notepad.exe - runas Administrator -- it works on two PCs - but doesn't work on the two. One of the two that don't work -- is using notepad ++.
Did you check to ensure that the file on the two systems that it won't work on is Read Only or not?  Regardless of whether you run as Administrator, if the file is explicitly set as Read Only, you will not be able to save it.

-saige-
It is not read only - we did check.
On one of the Windows 10 Machines , open cmd.exe with Run as Administrator and run:

SFC /SCANNOW followed by

dism.exe /online  /Cleanup-image /restorehealth

Restart and test again