Skip to content
LogoTechnipages
LogoTechnipages
  • Topics
        • Android
        • Browsers
        • Gaming
        • Hardware
        • Internet
        • iPhone
        • Linux
        • macOS
        • Office
        • Reviews
        • Software
        • Windows
        • Definitions
        • All Recent Posts
  • Product Reviews
  • About

Windows 11: Access Denied When Modifying HOSTS or LMHOSTS file

Mitch BartlettJuly 26, 2023 Comments (0)

Encountering an error while attempting to edit the LMHOSTS or HOSTS file in Microsoft Windows 11 is a common issue. You may come across one of the following messages:

  • “Access to C:\Windows\System32\drivers\etc\hosts was denied.”

or

  • “Cannot create the C:\Windows\System32\drivers\etc\hosts file. Make sure that the path and file name are correct.”

These errors usually indicate a lack of proper permissions to access the file. Fortunately, resolving this problem is relatively straightforward. Follow these steps to overcome the issue:


Allow Access One Time

  1. Select “Start” > “All Programs” > “Accessories“.
  2. Right-click on “Notepad” and select “Run as administrator“.
  3. If you are prompted for an administrator password or for a confirmation, type the password, or select “Allow“.
  4. Open the Hosts file or the Lmhosts file, make the necessary changes, and then click “Save” on the “File” menu.

Permanently Allow Access

Note: This option is not recommended as it may allow a virus or malware to easily modify the Hosts or Lmhosts file.

  1. Right-click the Hosts or Lmhosts file and select “Properties“.
  2. Select “Security“.
  3. Select the “Edit…” button to edit permissions.
  4. Select “Add…“.
  5. Type your username to allow just your account access, or type “EVERYONE” to allow access to anybody. Select “OK” when you’re ready.
  6. With the account you just added highlighted in the “Group or user names” area, select the “Allow” check for “Full control“. Select “OK” when you’re ready.

Congratulations! You now have access to edit the file, and you won’t receive any more “Access Denied” messages when attempting to work with it.

If you still encounter issues editing these files, it’s advisable to investigate whether malware or viruses are affecting your computer. You can try running a MalwareBytes scan to identify and resolve any potential threats.

Categories: WindowsTagged Updated0723

Author Mitch Bartlett

Through my career that spans over 20 years I have become an expert in Microsoft Systems Administration, Android, and macOS. I started this site as a technical guide for myself and it has grown into what I hope is a useful knowledgebase for everyone.

You Might Also Like

  • Gear Icon Header

    Enable/Disable Numlock at Windows Startup

    Mitch BartlettWindows
  • Windows Settings Header

    Windows 11: Fix “This publisher has been blocked from running software…”

    Mitch BartlettWindows
  • Win11 Send to Email Header

    Windows 11: “Mail recipient” Missing from “Send to” Menu

    Mitch BartlettWindows
  • Windows 10 Disable Quick Searches

    Windows 11: How to Disable Quick Searches

    Madalina DinitaWindows

Leave a Reply

Your email address will not be published. Required fields are marked *

how to allocate more memory to a program

How to Allocate More Memory to a Program in Windows

marvel rivals memory leak fix

Marvel Rivals Using Too Much Memory – How to Fix

how to create a macro in word

How to Create a Macro in Word

how to set video as screen saver

How to Set a Video as Your Screen Saver on Windows 11

how to fix 0xc000007b Error

Error 0xc000007b – What Is It and How to Fix It

profile pic

The Experts Behind Technipages

My name is Mitch Bartlett. I've been working in technology for over 20 years in a wide range of tech jobs from Tech Support to Software Testing. I started this site as a technical guide for myself and it has grown into what I hope is a useful reference for all.

Learn More

technipages logo white
linkedin icon

Technipages is part of Guiding Tech Media, a leading digital media publisher focused on helping people figure out technology. Learn more about our mission and team here.

© 2025 Guiding Tech Media All Rights Reserved

  • About Us
  • Contact
  • Legal & Privacy

© 2025 Guiding Tech Media All Rights Reserved

Information from your device can be used to personalize your ad experience.
Do not sell my personal information.

Last Updated on July 26, 2023 by Mitch Bartlett