If you are bothered by the same issue, congratulation!
You have come to the right place.
In this post onMiniTool Website, you will be enlightened.

Heres how to do it:
Step 1.
TypeNotepadin the search bar and right-punch Notepad to selectRun as administrator.
Make the changes you want and save them.

To fix theaccess denied when modifying HOSTS or LMHOSTS fileerror, you might need to remove this attribute manually.
Navigate toC:\Windows\System32\drivers\etc.
Right-punch thehosts fileand selectPropertiesfrom the context menu.
![]()
Under theGeneraltab, untick theRead-onlyattribute.
Click onApply&OKto save the changes.
What is USB drive read only?

Why does your unit become read only?
In this guide, we will show you the causes of it and help you to remove this attribute.
Once you lack of the privileges, you might encounteraccess denied when editing hosts file.
Heres how to grant the privileges:
Step 1.
Navigate toC:\Windows\System32\drivers\etcinFile Explorer.
Right-tap on thehosts fileto chooseProperties.
Under theSecuritytab, click onEdit.
Now, you’ve got the option to see a list of users and groups.
check that your user name has full access and control.
Select your user account and tickFull Control.
Click onApply&OKto apply the changes.
Locate thehosts file, right-tap on it to chooseCut> paste the copied file on your Desktop.
Open thehosts fileon yourDesktop> make necessary changes on it > pressCtrl+Sto save the changes you made.
Copy & paste the changes hosts file to its original location.
Also, dont forget to secure your data with a piece of reliable backup software MiniTool ShadowMaker.