search
HomeComputer TutorialsComputer KnowledgeFixed! Access Denied When Modifying HOSTS or LMHOSTS File

Resolve "Access Denied" error when modifying HOSTS or LMHOSTS files on Windows 10/11

Modifying hosts files is a relatively advanced operation. You may encounter errors such as "Access Denied" during modification of HOSTS or LMHOSTS files. If you also experience this issue, please continue reading this article and we will provide you with a solution.

"Access Denied" Error: Modify HOSTS or LMHOSTS file

Sometimes, you need to change the hosts file to resolve certain issues or block specific websites on your computer. The hosts file is stored in the computer's installation directory and cannot be edited without authorization. Don't worry, follow the steps below and you can easily resolve the error of "Access denied when modifying HOSTS or LMHOSTS files".

Fix "Access Denied" error when modifying HOSTS or LMHOSTS files on Windows 10/11

Method 1: Run Notebook as an administrator

Before editing the hosts file, you need to run Notepad as an administrator. The operation steps are as follows:

  1. Type Notepad in the search bar, right-click Notepad and select Run as administrator.
  2. Click File > Open > Navigate to C:\Windows\System32\drivers\etc > Change Text Files (*.txt) to All Files > Select hosts Files > Click Open.

Fixed! Access Denied When Modifying HOSTS or LMHOSTS File

  1. Make the required changes and save.

Method 2: Cancel the read-only attribute of the hosts file

If the hosts file is set to read-only, it cannot be changed or edited. To resolve the error "Access denied when modifying HOSTS or LMHOSTS files", you may need to delete this property manually.

  1. Press Win E to open File Explorer.
  2. Navigate to "C:\Windows\System32\drivers\etc".
  3. Right-click on the hosts file and select Properties from the context menu.
  4. Under the General tab, uncheck the Read-Only property.

Fixed! Access Denied When Modifying HOSTS or LMHOSTS File

  1. Click Apply and OK to save the changes.

Method 3: Change the security settings of hosts file

To access these files, you need special permissions. If you lack permissions, you may encounter the error "Access denied when editing hosts file". Here is how to grant permissions:

  1. In File Explorer, navigate to "C:\Windows\System32\drivers\etc".
  2. Right-click on the "hosts file" to select "Properties".
  3. Under the Security tab, click Edit.
  4. Now you can see a list of users and groups. Make sure your username has full access and control permissions.

Fixed! Access Denied When Modifying HOSTS or LMHOSTS File

Select your user account and select "Full Control".

  1. Click Apply and OK to apply the changes.

Method 4: Change the location of the hosts file

It is reported that changing the file location also helps to resolve the error of "Access denied when modifying HOSTS or LMHOSTS files".

  1. In File Explorer, navigate to "C:\Windows\System32\drivers\etc".
  2. Find the "hosts file", right-click it and select "Cut" > Paste the copied file on your desktop.
  3. Open the "hosts file" on the desktop > Make the necessary changes to it > Press Ctrl S to save the changes you made.
  4. Copy and paste the changed hosts file to its original location.

Summarize

In this guide, we introduce four ways to fix the “Access denied when modifying a HOSTS or LMHOSTS file” error. Also, don't forget to use reliable backup software such as MiniTool ShadowMaker to protect your data security.

The above is the detailed content of Fixed! Access Denied When Modifying HOSTS or LMHOSTS File. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Is LifeCam Studio Not Working in Windows 11? Here Are Fixes! - MiniToolIs LifeCam Studio Not Working in Windows 11? Here Are Fixes! - MiniToolMay 07, 2025 am 12:20 AM

LifeCam is a well-known line of webcams made by Microsoft. However, some users reported that LifeCam Studio was either not detected or not working on Windows 11. If you are one of them, you can refer to this post from php.cn to find solutions.

Top 5 Free Microsoft Word Alternatives for Word Processing - MiniToolTop 5 Free Microsoft Word Alternatives for Word Processing - MiniToolMay 07, 2025 am 12:19 AM

Microsoft Word is the most common word processing app that lets you create and edit word documents. It is available as a standalone app or as a component of the Microsoft Office suite. You need to buy Microsoft Word or Microsoft Office/365 to get the

App Store Won't Download or Update Apps? Fixed with 8 Tips - MiniToolApp Store Won't Download or Update Apps? Fixed with 8 Tips - MiniToolMay 07, 2025 am 12:18 AM

If the iPhone/iPad App Store won’t let you download apps, you may try the 8 tips in this post to see if they can help you fix the App Store won’t download or update apps issue. For more computer tips and tricks, you may visit php.cn Software official

Walmart Not Working? Troubleshooting Steps Are Here for You! - MiniToolWalmart Not Working? Troubleshooting Steps Are Here for You! - MiniToolMay 07, 2025 am 12:17 AM

In your daily time, the Walmart app can play as an online market where you are allowed to browse through a variety of commodities and get groceries delivered to your door. Sometimes you may struggle with the “Walmart app not working” issue and as for

[7 Easy Ways] How to Fix File System Error Chromebook Camera? - MiniTool[7 Easy Ways] How to Fix File System Error Chromebook Camera? - MiniToolMay 07, 2025 am 12:16 AM

This article discoursed by php.cn mainly teaches you the methods to deal with Chromebook Camera not working files system error. All solutions have managed to help users with similar issues. Move on to find your solution!

Apple Warranty Check – How to Check iPhone, iPad, Mac Warranty - MiniToolApple Warranty Check – How to Check iPhone, iPad, Mac Warranty - MiniToolMay 07, 2025 am 12:15 AM

Knowing Apple warranty check may be what you need before you purchase Apple devices including iPhone, iPad, Mac, Apple Watch, and other products. How to check Apple warranty? Follow the guide from php.cn and you can find 3 ways for this task.

6 Powerful Fixes for Dota 2 Disk Write Error on PC6 Powerful Fixes for Dota 2 Disk Write Error on PCMay 07, 2025 am 12:14 AM

Although Dota 2 is considered a solid performing game, you can receive some issues like Dota 2 disk write error when trying to update the game. If you receive the same error, the solutions below on php.cn Website might help you out.

A Guide on Camera Download for Windows 10/11 PC and Install - MiniToolA Guide on Camera Download for Windows 10/11 PC and Install - MiniToolMay 07, 2025 am 12:13 AM

Does Windows 10 have Camera software? How do I download Microsoft Camera? If you are curious about Windows 10 Camera app download, you come to the right place. This post from php.cn focuses on Windows Camera download for Windows 10/11 and installatio

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment