Why can I not edit this file?

Page 1 of 2 12 LastLast

  1. Posts : 61
    Windows 10.
       #1

    Why can I not edit this file?


    I知 trying to learn Windows permissions.
    I'm an administrator and have full control on this file:
    c:\windows\system32\drivers\etc\hosts
    Why can I not edit it?
    I could edit it when I added my user with full control, but why is this necessary?

    Any help much appreciated
    Why can I not edit this file?-picture3.png
      My Computer


  2. Posts : 23,282
    Win 10 Home ♦♦♦19045.4355 (x64) [22H2]
       #2

    rodion15 said:
    I知 trying to learn Windows permissions.
    I'm an administrator and have full control on this file:
    c:\windows\system32\drivers\etc\hosts
    Why can I not edit it?
    I could edit it when I added my user with full control, but why is this necessary?

    Any help much appreciated
    Why can I not edit this file?-picture3.png



    It's most probably set to "Read Only".
    Just right click it and choose Properties, and uncheck the Read Only box.
    Edit the HOSTS file, then Save.
    Lastly, make sure to set it as Read Only again.

    You shouldn't have to change any permissions to do that.
    Last edited by Ghot; 13 Apr 2022 at 22:01.
      My Computer


  3. Posts : 30,611
    Windows 10 (Pro and Insider Pro)
       #3

    Anything inside Windows/system32 folders is assumed as system files. It is normal that you have to make any changes with elevated user rights.

    For instance.. start Notepad as admin (right click on it and select run as admin), open hosts file, edit it and save... no problems
      My Computers


  4. Posts : 43,010
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #4

    This
    Download BlueLife Hosts Editor v1.3
    is designed to deal with this.. including the permissions issues. Makes it easy.
      My Computers


  5. Posts : 98
    Win 10 Pro 21H2
       #5

    Be aware that each subsequent Windows 10 version (21H1 to 21H2, for example) changes all, repeat, ALL, Windows-owned (ie, trustedinstaller) file and folder permissions to their default values. Additionally, Windows owned files that are missing will be recreated. Even entries in the registry will be restored/modified to their default values as well. Also, all Windows services are restored to their default startup types!

    I speak from experience. I'd estimate I had more than 50 hours of manually making Windows changes wiped out when I upgraded 21H2 to 21H2. So now I limit my changes to the most important to me.
      My Computer


  6. Posts : 31,682
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #6

    rodion15 said:
    I知 trying to learn Windows permissions.
    I'm an administrator and have full control on this file:
    c:\windows\system32\drivers\etc\hosts
    Why can I not edit it?

    Imagine what mischief malware could do in the way of hijacking the HOSTS file if you did give your account full permission to save an edited version of it directly to \windows\system32\drivers\etc\.

    Rather than fight Windows permissions, when I want to edit HOSTS I open it from \windows\system32\drivers\etc\ in Notepad, make my changes, then save the edited version elsewhere. The default permissions do allow you to delete \windows\system32\drivers\etc\HOSTS and replace it with another copy, so that's what I then do.
      My Computers


  7. Posts : 67
    Win10 Home 64-bit, MX-Linux
       #7

    rodion15 said:
    I’m trying to learn Windows permissions.
    I'm an administrator and have full control on this file:
    c:\windows\system32\drivers\etc\hosts
    Why can I not edit it?
    I could edit it when I added my user with full control, but why is this necessary?
    Windows has the feature, enabled by default, called User Account Control. With that on, users who are members of the Administrator Group do not have immediate access to privileges/permissions that Administrators have, without taking
    further action such as clicking in a consent dialog, or specifically causing a program to "Run as Administrator". It's
    considered very insecure to turn that feature off.
      My Computer


  8. Posts : 98
    Win 10 Pro 21H2
       #8

    One more warning for non-techies 'playing around' with Windows...don't do it!

    Back in the Windows 98 and XP days, one of my very-non-techie friends wanted to 'learn about Windows' and would routinely delete and/or rename files and folders inside of Windows. Most of the time, he got lucky and didn't kill Windows as it would still reboot.

    Fortunately, he didn't play his games very often. But about once per year, he'd wipe out enough of Windows that it wouldn't boot at all and he'd call me. The first time, I struggled for hours to get it to boot, without luck. So I started with FORMAT C: and reinstalled Windows from a CD of mine. Fortunately, the license sticker was on the box so I could enter the correct serial number. As he lost or tossed the installation CDs that came with his computers, I had to look at individual chip numbers to determine which device drivers to download and install. These days, Win 10 has device drivers built in for anything more than a year old or so.

    When he called me the 2nd time, I had to chase down the drivers again, but wrote them all down and taped it to the inside of his computer case. He only screwed things up 1 or 2 times after that, perhaps because I told him I wasn't going to fix his problems any more. He ultimately went to a local computer store and they put him into a Windows 7 computer, which pretty much ended his experimenting with Windows.
      My Computer


  9. Posts : 7,607
    Windows 10 Home 20H2
       #9

    I just dragged "host" from "etc", dropped it onto the desktop, edited it, saved it, and dragged it back into "etc".
    There was no need to change the permission.
      My Computer


  10. Posts : 61
    Windows 10.
    Thread Starter
       #10

    bratkinson said:
    Be aware that each subsequent Windows 10 version (21H1 to 21H2, for example) changes all, repeat, ALL, Windows-owned (ie, trustedinstaller) file and folder permissions to their default values. Additionally, Windows owned files that are missing will be recreated. Even entries in the registry will be restored/modified to their default values as well. Also, all Windows services are restored to their default startup types!

    I speak from experience. I'd estimate I had more than 50 hours of manually making Windows changes wiped out when I upgraded 21H2 to 21H2. So now I limit my changes to the most important to me.
    Interesting. Maybe that's why I have this issue where I change the settings for my mouse and keyboard so it doesn't wake the PC when clicked/typed, and then after one of these updates (or upgrades) this setting is enabled again.

    - - - Updated - - -

    bratkinson said:
    Be aware that each subsequent Windows 10 version (21H1 to 21H2, for example) changes all, repeat, ALL, Windows-owned (ie, trustedinstaller) file...
    So a way to reset default permissions is to do an in-place-upgrade? or maybe it's better to use apps to reset windows permissions?

    - - - Updated - - -

    bratkinson said:
    Be aware that each subsequent Windows 10 version (21H1 to 21H2, for example) changes all, repeat, ALL, Windows-owned (ie, trustedinstaller) file...
    <br>So an easy way to reset to default permissions is to do an in-place-upgrade? or maybe it's better to use apps to reset windows permissions?
    <br>
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

ゥ Designer Media Ltd
All times are GMT -5. The time now is 17:53.
Find Us




Windows 10 Forums