Having trouble editing the hosts file in Windows 10 due to access denied? Here’s how to fix it.
Edit with Administrator Privileges
To edit the hosts file in Windows 10 with administrator privileges, follow these steps:
1. Open File Explorer and navigate to the directory where the hosts file is located. The default location is C:\Windows\System32\drivers\etc\.
2. Right-click on the hosts file and select “Properties” from the context menu.
3. In the Properties window, go to the “Security” tab.
4. Click on the “Edit” button to change the file-system permissions.
5. In the Permissions window, select your user account and check the box next to “Full control” under the “Allow” column.
6. Click “Apply” and then “OK” to save the changes.
7. Now you can open the hosts file with a text editor like Windows Notepad and make the necessary edits.
Disable Read-Only Attributes
1. Open File Explorer and navigate to the directory where the hosts file is located.
2. Right-click on the hosts file and select “Properties” from the context menu.
3. In the Properties window, go to the “General” tab and uncheck the “Read-only” checkbox.
4. Click “Apply” and then “OK” to save the changes.
5. If you encounter an error message saying you don’t have permission to edit the file, you may need to take ownership of the file. Right-click on the hosts file again and select “Properties.”
6. Go to the “Security” tab and click on the “Advanced” button.
7. In the Advanced Security Settings window, click on the “Change” link next to the owner’s name.
8. Type your username in the “Enter the object name to select” field and click “Check Names” to validate it. Then, click “OK” to set yourself as the owner.
9. Back in the Advanced Security Settings window, click on “Add” to add your user account to the list of permissions.
10. Type your username in the “Enter the object names to select” field and click “Check Names” to validate it. Then, click “OK” to add your account.
11. In the permissions list, select your username and check the “Full Control” box under the “Allow” column.
12. Click “Apply” and then “OK” to save the changes.
Now you should be able to edit the hosts file without encountering the “access denied” error.
Modify Security Settings
Step | Description |
---|---|
Step 1 | Locate the hosts file in Windows 10. It is usually located at C:\Windows\System32\drivers\etc\hosts . |
Step 2 | Right-click on the hosts file and select Properties. |
Step 3 | Go to the Security tab in the properties window. |
Step 4 | Click on the Edit button. |
Step 5 | In the Group or user names section, select your user account or the Administrators group. |
Step 6 | Under the Permissions for… section, check the Full control option. |
Step 7 | Click Apply and then OK to save the changes. |
Step 8 | Try editing the hosts file again. The access denied error should be resolved. |
Alter File Location
To alter the file location of the hosts file in Windows 10, follow these steps:
1. Open File Explorer and navigate to the directory where the hosts file is located. The default location is C:\Windows\System32\drivers\etc.
2. Right-click on the hosts file and select “Properties” from the menu.
3. In the Properties window, go to the “Security” tab.
4. Click on the “Edit” button to change the file-system permissions.
5. In the Permissions window, highlight the user account that you want to grant access to and click on the “Full control” checkbox.
6. Click “Apply” and then “OK” to save the changes.
7. If prompted, provide administrative credentials to confirm the changes.
By altering the file location and adjusting the file-system permissions, you should be able to edit the hosts file without encountering the “Access Denied” error.
Frequently Asked Questions
Why can’t I edit my hosts file?
You cannot edit your hosts file because it is a system file that requires elevated privileges. To modify it, you need to run a text editor like Notepad as an administrator.
Why host file entry is required?
A host file entry is required to override the DNS system for testing purposes or to redirect a Web browser or application to a specific IP address.
How do I access my host file?
To access your host file, you need to run Notepad as an administrator. Right-click on Notepad in your start menu and select “Run as Administrator.” Then, go to File > Open and browse to c:\Windows\System32\Drivers\etc\hosts.
How do I give permission to host file in Windows 10?
To give permission to host file in Windows 10, you can follow these steps:
1. Press the Windows key.
2. Type Notepad in the search field.
3. In the search results, right-click Notepad and select Run as administrator.
4. From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts.
5. Make the necessary changes to the file.
6. Select File > Save to save your changes.