Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Do not have access to hosts file

15 Apr 2012   #1

64 bit home premium
Do not have access to hosts file

Hi all,

I've been trying to battle a little problem for quite some time now.

My hosts file has been encrypted with some different IP addresses which inevitably redirect me to some websites.

I have tried to open my hosts file through notepad as administrator, then take out the bad IP addresses and when I try to save I get access denied.

The hosts file itself is set to read only and I do not have "access" to change it.

My user account is the sole account on this PC and is infact the administrator.


-Note pad administrator won't work with changing hosts file
-hosts file won't let me change securities parameters

I'm begging for help! I've spent several hours trying to find a guide and every single one says to use Notepad in administrator but that just isn't working for me

Edit-All these attempts have been in safemode with networking

My System SpecsSystem Spec
15 Apr 2012   #2

Win7 Ultimate x64 SP1 / WCP x64 / Ubuntu 11 x64

Have you run Notepad as Administrator?
My System SpecsSystem Spec
15 Apr 2012   #3

Windows 10 Pro x64

Use the MS Fixit tool to resolve the issue
How can I reset the Hosts file back to the default?
My System SpecsSystem Spec

15 Apr 2012   #4

64 bit home premium

Influx~ I said several times that I ran notepad as administrator


I tried running the tool and that did not solve the problem. The hosts file is still set to read only and I do not have access to change it.

I tried the manual method and it won't let me save the original file as hosts.old

Nor when i right click within the etc file does new give me an option to make a text document.

I'm open to more ideas!
My System SpecsSystem Spec
15 Apr 2012   #5

Win7 Ultimate x64 SP1 / WCP x64 / Ubuntu 11 x64

Quote   Quote: Originally Posted by envz28 View Post
Influx~ I said several times that I ran notepad as administrator
Follow the complete instructions here on taking ownership with a file/folder. Windows 7 Take Ownership & Grant Permissions to Access Files & Folder
My System SpecsSystem Spec
15 Apr 2012   #6

Windows 8.1 Pro RTM x64

The following lines of code have been posted numerous times, but it is a useful batch file to have in your tool kit. It flushes the DNS cache and resets Microsoft's Host File.

@Echo on

attrib -h -s -r hosts
echo localhost>HOSTS
attrib +r +h +s hosts
ipconfig /release
ipconfig /renew
ipconfig /flushdns
netsh winsock reset all
netsh int ip reset all
shutdown -r -t 1
del %0

Copy and paste the above in to Notepad and save it as Flush.bat to the desktop. Close all running applications and then right-click on the file and choose to run as an administrator, providing the necessary credentials when prompted. Your computer will automatically restart itself.
My System SpecsSystem Spec
15 Apr 2012   #7

64 bit home premium

Dwarf~ I did your steps, not 100% what the object of that was. However it still did not fix the problem. From reading that command it looked like a reset of the hosts file but yeah still didn't work

Influx~ I am following the steps but am stuck at a part in which I tried way before hand and it still will not work

*On step 5 in "How to Grant Permission in Windows 7"

When trying to change the permission settings to Full Control I am unable to check the box.


*my etc folder had the owner set to TrustedInstaller. I then changed the owner of the file to Ben *i.e. my account*

I was then allowed to check the "Full Control" setting, however when I tried to apply the change I was given:

Error Applying Security

An error occured while applying security information to:


Access is denied

More help needed!

*Side note, this sucks lol*
My System SpecsSystem Spec
15 Apr 2012   #8

64 bit home premium

So i got the bright idea to go to the root:

I went to my C: and right clicked and changed the security level there to allow me Full Access and I did this to every file up to etc. I successfully was able to change the hosts file to allow me Full Control.

As of right now my hosts file is clear of all those pesky advertising IP addresses.

I appreciate all your help. Your suggestions sort of led me onto the track. I will update if things go haywire

Thanks so much!

My System SpecsSystem Spec

 Do not have access to hosts file

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar help and support threads
Thread Forum
Hosts file ignored and replaced with hosts.original
Hello. I am trying to use the hosts file. However both pings and web addresses still bypass the hosts file. I noticed that there is another file in the C:\Windows\System32\drivers\etc directory called 'hosts.original'. When ever I delete this file, it reappears seconds later. I have made sure that...
General Discussion
Hosts File
Hey, I was wondering, is there any internet performance gain if you put a commonly used website's IP (like Google) in your Hosts file, so it doesn't need to ask a DNS server? I mean, because I have 30 websites I go on at least 10 times each day, and it lags when I open all of them :D Thanks!
General Discussion
Hosts: always Access Denied or asking for Admin permissions
So I've been trying to modify my hosts file for a while now. On and off because I was fed up with searching and trying different things then always ending up failing. So that is why I am posting on this forum, asking for help from you guys. So far I have tried: Unchecking Read-Only for the...
General Discussion
Hosts file-S??
can the hosts file be changed to, or amended by, another file? IOW can there be a file named xyz that essentially replaces the hosts file, or adds entries to it? Possibly by a registry key or configuration setting? Of course it could by altering library fxns, but by other "simpler" means? ...
System Security
HOSTS File - Create a "Edit HOSTS file" Shortcut
How to Create a "Edit HOSTS file" Shortcut in Windows 7 and Vista The HOSTS file is a .txt file used in Vista and Windows 7 to map hostnames to IP addresses. Your computer checks this file first to resolve any network names to its corresponding IP address before it tries to check the Internet....

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 18:47.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App