When saving my host file an error comes back and says you need permission for the owner to make this change. All my computers are doing this. How I Fix this?
4 Answers
The HOSTS file is secured (even for the owner).
Find Notepad, right click on it, and then select Run as Administrator.
Now in Notepad, navigate to HOSTS, change it (edit it) and save it.
The Edit and Save will work and this is entirely expected and normal.
-
1
hosts
is owned bySystem
and while ownership of files within%WinDir%
should never be owned by a user, a user can give themselves full permissions to the file (AFAIK, ownership of files within%WinDir%
, even user-editable ones within%WinDir%\System32\drivers\etc
, should never be changed)– JW0914Apr 26, 2022 at 12:27
As John said, HOSTS file is secured.
I did some trick to "ignore" that issue, maybe it helps:
Edit Hosts file (MAKE A BACKUP OF THAT FILE BEFORE EDITING, ALWAYS!!)
Save it to C:/Documents (or whatever path you'd like)
Copy that hosts file
Paste it where you are saving and gives error
Replace
Should be good to go
-
-
Common practice, to backup a sensitive file before editing, like a registry file, I always advise to take a screenshot or back up those kind of files before doing something, you should always be able to "revert" any change you're doing, you never know what can happen when you're editing! Apr 26, 2022 at 13:01
-
The
hosts
file isn't a critical system file and is not analogous to a Registry hive in it's importance. What mistake do you believe would happen when editing thehosts
file and why would a backup be needed to revert such a mistake? (This answer and subsequent reply makes it seem as though there may be a misunderstanding as to the purpose of thehosts
file.)– JW0914Apr 26, 2022 at 13:17 -
Had a boss that wanted to "block" sites like facebook, instagram, etc. With the genious idea that he didn't like users to "google" sites while at work (they had to use the Work App @ all times).. So he added google.com to the hosts file, sadly, the Work App used a Google Service to update itself, with that hosts file block it couldn't connect causing a loop. We couldn't really find the problem until he told us that he was blocking sites.. The application didn't update every day, but when it tried to, it was blocked. Apr 26, 2022 at 13:26
-
I'm not understanding how the reply applies to what I'm asking.
hosts
isn't a system critical file and is not even used by default -hosts
is only used when modified by the user to direct a specific IP/host name to a specific host name/IP [format:<IP> <hostname> <hostname>.<localdomain>
||<IP> <hostname>.<domain>
]– JW0914Apr 27, 2022 at 12:17
You need to open notepad with a Right Click > Run As Administrator.
This will allow you to edit and save the hosts file without moving it. You'll need to reboot your computer for any changes you make to come into affect.
Seems even if you are a member of local predefined group (as Administrators S-1-5-32-544
) you won't be able to edit file due to UAC. For such built-in groups Windows requires the app to have elevated token: only with such a token the group membership is taken into account.
To workaround you can create artificial local group or grant user privilege directly to the file. Otherwise the only option is to run an app elevated.
hosts
file to somewhere outside its original directory, make your changes, and then copy it back. Backing up the originalhosts
file under a different title may be advisable before proceeding (e.g. change its name tohosts.original
).hosts
with Full Control permissions or the other suggestions of opening a text editor as Administrator (I prefer the former over the latter, as it's more efficient)