Skip to content
LogoTechnipages
technipages logo
  • Topics
        • Android
        • Browsers
        • Gaming
        • Hardware
        • Internet
        • iPhone
        • Linux
        • macOS
        • Office
        • Reviews
        • Software
        • Windows
        • Definitions
  • Product Reviews
  • Downloads
  • 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

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. Mitch's Favorite Gear ATX Graphics Card CanaKit Raspberry Pi 3

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
  • Windows 10 Disable Quick Searches

    Windows 11: How to Disable Quick Searches

    Madalina DinitaWindows
  • windows 10 blank file on desktop

    Fix: Empty File Appeared on Windows 11 Desktop

    Madalina DinitaWindows

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

300x600
Turning on Triple Touch Zoom on Android

Turning on Triple Touch Zoom on Android

How to Connect Outlook 2023 to Gmail

How to Connect Outlook 2023 to Gmail

Netflix: Change Password

Netflix: Change Password

Everything You Need to Know About WhatsApp Delete for Me

Step-by-Step Guide: How to Use WhatsApp on Your Computer

Android: Enable or Disable Background Data

Android: Enable or Disable Background Data

300x250
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

300x250 2
technipages logo white
linkedin icon

Technipages is part of Guiding Tech Media, a leading digital media publisher focused on helping people figure out technology. Visit guidingtechmedia.com to learn more about our mission and team.

© 2026 Guiding Tech Media All Rights Reserved

  • About Us
  • Contact
  • Legal & Privacy

© 2026 Guiding Tech Media All Rights Reserved

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