Windows hosts file

Unable to Save Hosts File on Windows 7, Vista, XP

In general we are able to modify system file
to map an ip address to name. However the default owner of hosts file is system, therefore we need to have administrator privilege to modify file hosts otherwise you will get error like “access to hosts file is denied”.

Windows hosts file
Windows hosts file

Access to C:\Windows\system32\drivers\etc\hosts was denied


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

Method #1 to modify hosts file on Windows 7 / Windows Vista

Edit the hosts file using notepad with Administrator’s right

1. Open your Notepad or Wordpad with administrator privilege. Click Start → type Notepad.exe in the search box, so that it appears in the program list (or browse to it Start → Accessories → Notepad)

Right-click Notepad.exe and choose Run as Administrator

2. If you prompted by UAC (User Account Control), click Yes OR type in the username with admin privilege and it’s password

3. In your Notepad window, click File → Open  then browse to

select All Files*.*, then open and modify hosts file

Method #2 to modify hosts file on Windows 7 / Windows Vista

Take ownership of the hosts file and change its permission

  1. Right click on hosts file and click “Properties”.
  2. Switch to “Security” tab and click Edit button.

    hosts file properties user
    Properties of hosts file on Windows
  3. Click your user name or group name (in this example, my username is Users).
    hosts file permission
    hosts file permission

    If you don’t see your username or group name on the lists, click Add → Advanced → Find Now → Click Username → OK → OK.

  4. In Permissions for Users (your windows Username) setting, click Allow on Full control option.

    hosts file permission allow
    click allow on hosts file permission
  5. Click OK → Confirm Yes → OK
  6. Now you can edit hosts file with notepad as normal without getting denied error message again.

Published by

Febryan Paudi

Febryan Paudi is Apple enthusiast. Falling in love with Apple-tech since 2008, loves Blogging since high-school. Google+

Leave a Reply