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:
- Right click on Notepad (or your preferred text editor) and select Run as Administrator.
- Click on File -> Open (or Open button on most text editor), and browse to the following folder:
Tip: You can copy and paste into location bar if you cannot see the folder at depth.
- In the file type drop down list, click and select All Files (*.*).
- Open the hosts file.
- After editing, just save the host file, and it will be changed properly without error.