If you encounter the error You don't have permission to save in this location when you are trying to save the Hosts file, that means the account that you logged in you doesn't have administrator permission to save a file or the hosts file is protected by other programs. You may try the following suggestions one by one to check the issue.
- Check if you are logged in as administrator account, guest account will have permissions problem.
- Temporarily disable antivirus program when you are editing the hosts file.
Programs like Windows Defender will prevent unauthorized changes to the hosts file. If you know what you are doing, you can temporary disable the hosts file protection.
To disable hosts file protection in Windows Defender: Open Windows Defender, switch to the "Settings" tab, click on the left side "excluded files and locations" option, click "Browse" button, navigate to the location of the hosts file as C:\Windows\System32\Drivers\etc\hosts, then click on the "Add" button, then click "Save Changes."
- If you are using administrator account and your antivirus programs is off, you can use the following method to resolve the problem. Applies to win7/win8/win8.1 ...
Right-click notepad.exe, then left-click "Run as administrator". You can now open and edit the Hosts file.
One way that is not recommended for fixing this problem is by modifying the hosts file's permissions and makes it editable for anyone. Changing hosts file's permission will make the system vulnerable.