Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to edit the hosts file on Windows Server 2008.

I right clicked on Notepad and Ran as Administrator, then opened the hosts file, but when I try to save it I get the following error message:

Cannot create the C:\Windows\System32\drivers\etc\hosts file.
Make sure that the path and file name are correct.

Next I checked the permissions for Administrators on the hosts file. The following are checked as Allow:

  • Full Control
  • Modify
  • Read & execute
  • Read
  • Write

When I edit the permissions, all the check boxes are gray and not editable.

Next I check the file Owner of the hosts file. The Current owner is SYSTEM. When I try to edit the Owner I get the following message.

You only have permission to view the current owner on hosts.

The Windows documentation states

Ownership can be taken by:

An administrator. By default, the Administrators group is given the Take ownership of files or other objects user right.

In the Local Security Policy under the User Rights Assignment section, Take ownership of files or other objects is set to Administrators.

Why wouldn't I be able to change ownership to edit the hosts file?

share|improve this question
up vote 3 down vote accepted

I have seen antivirus programs do something similar. The AV program can intercept even Administrator file access. Many malware programs modify hosts to redirect certain sites without mucking around with DNS servers, so AV programs are hyper aware of that one file.

share|improve this answer
I had the AV disabled, but I went a head an uninstalled it and sure enough I was able to edit the hosts file after that. – Mark Robinson Sep 13 '11 at 12:58

Copy hosts file on the other location, for example on Desktop. Edit that file which is on the Desktop and then copy file back to the original location and overwrite the old one.


share|improve this answer

User Account Control is on. Open notepad as an administrator (Right-click, Run as administrator) and then open the hosts file from there. It will let you save the file then.

share|improve this answer
Right-click, Run as Administrator is what I meant by ran Notepad as Administrator .. sorry it wasn't clear. – Mark Robinson Sep 12 '11 at 18:32
sorry i totally missed that in your post. Well I'm not sure what to tell you then...I wouldn't focus on ownership of the file though. Hosts is a special file so I'm not surprised there are special restrictions on that aspect. Maybe there is something wrong with the admin account you are using? – August Sep 12 '11 at 18:45
could be but I can't find any documentation on what those special restrictions are, maybe something related to the SYSTEM owner. – Mark Robinson Sep 12 '11 at 18:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.