Introduced in Windows Vista, User Account Control (UAC) has been a prominent feature that breaks and changes many usual behavior of Windows operating system including Windows 7, and probably all future Windows versions such as Windows 8. One annoying is that it’s no longer possible to directly edit the hosts file with Notepad, that allows users to override DNS and map IP addresses to its respective domains.

If you just run Notepad or any other text editor and open hosts file located in %WinDir%/System32/drivers/etc/ folder, when you try to save the edited or modified hosts, the following error message will appear:

You don’t have permission to save in this location. Contact the administrator to obtain permission.

The error that causes unable to save the hosts file happens even though user has been logged on to Windows as administrator, with with a user account with administrator’s privilege (belongs to Administrators user group).

And the hosts file cannot be overwritten or replaced too. So it’s impossible to save the new hosts file into another location, and trying to copy or move the hosts file over to its original folder, without getting this error:

You’ll need to provide administrator permission to copy to this folder.

Note: In Windows 7, UAC has been improved so that you can just click on “Continue” to initiate the copying or moving if you have logged in with an administrator account, or by proving credential for an administrator account.

Windows disallow all applications with non-elevated privileges to make change to important system files or folders. Here’s the proper way to modify or edit the hosts file:

  1. Right click on Notepad (or your preferred text editor) and select Run as Administrator.

    Run Notepad as Administrator

  2. Click on File -> Open (or Open button on most text editor), and browse to the following folder:

    %SystemDrive%\Windows\System32\Drivers\etc

    Tip: You can copy and paste into location bar if you cannot see the folder at depth.

  3. In the file type drop down list, click and select All Files (*.*).
  4. Open the hosts file.

    Edit Hosts in Windows 7 and Vista

  5. After editing, just save the host file, and it will be changed properly without error.

Related Posts