Cannot edit hosts file Win 11 prof

Discussion in 'Software' started by Frunkenstein, Jun 19, 2024.

  1. Frunkenstein

    Frunkenstein Noisemaker

    Joined:
    Feb 2, 2024
    Messages:
    7
    Likes Received:
    4
    I have googled and followed all the steps to edit my hosts file on Win 11 prof and it will not allow me.

    I navigate to the file, copy it and paste it to my desktop. Then I open notepad as administrator, then open the hosts file on my desktop, edit it, save it, then go to replace it back in the /etc folder. It asks me for admin privileges and everything is going as all the articles and tutorials explain, it copies it, all good, BUT THEN I get the message "You need permissions to perform this action" and it shows an icon of the /etc folder with the options to "try again" or "cancel." I just cannot get this task done.

    I'm at a loss here. I have Windows Defender turned off, no anti-virus running. I know diddly squat about Windows because I'm a former Mac user, but there is some damn setting somewhere that is preventing me from editing my hosts file and it's driving me insane because after HOURS of sorting through google results I cannot find this specific problem that is preventing me from editing my hosts file. It's sitting through videos and reading tutorials of the same instructions over and over and over again but nobody is explaining the result that is happening to me. All of the articles/tutorials/videos are the same "do these things, and boom it's that easy!" And I'm sitting here like "nope, what the actual fuck.. there is obviously a condition/setting that exists where it isn't that easy."

    My next resort is installing Power Tools and trying the hosts file editor in there, but I really don't want to install that because it comes with a whole bunch of bloat I won't use, and from looking into it, it looks like Power Tools will also create and hold hostage a whole bunch of new system wide keybinds that will conflict with my DAW keybinds most likely.

    Thankful for any help.

     
  2.  
  3. lampwiikk

    lampwiikk Member

    Joined:
    Jun 15, 2011
    Messages:
    394
    Likes Received:
    16
    Location:
    California
    Try right clicking on the hosts file, go to properties, and check at the bottom if "read only" is checked. If so, uncheck it and try that. I have had the same issue, but once I fixed that I can just edit and save the hosts file directly
     
  4. zalbadar

    zalbadar Ultrasonic

    Joined:
    Oct 24, 2011
    Messages:
    184
    Likes Received:
    35
    Make a copy of it.
    Edit the copy.
    Then paste into the original folder. It will ask if you want to overwrite it it. You click overwrite and it's all done.

    I had a similar problem once. The cause was something is accessing it when your trying to edit it. so it won't let you.

    Anyway do the above and it should work
     
  5. Kelsier

    Kelsier Kapellmeister

    Joined:
    Feb 9, 2024
    Messages:
    87
    Likes Received:
    46
    If you open it in Notepad++ it will save as admin for you
     
  6. saccamano

    saccamano Rock Star

    Joined:
    Mar 26, 2023
    Messages:
    1,098
    Likes Received:
    439
    Location:
    uranus
    Check out this link https://www.elevenforum.com/t/add-take-ownership-to-context-menu-in-windows-11.1230/
    and apply the take ownership command to your context menus.

    Make certain you (more exactly, the account you log in with) are a member of the LOCAL ADMINISTRATORS group. Go to the hosts file and "take ownership" of it. If you still get silly admin access messages "take ownership" of the entire folder. Open the hosts file and make your edits/saves. I would strongly recommend replacing notepad with Notepad II or Notepad + because they can help in situations like these. When finished it is recommended you set the hosts file to read-only. This can be accomplished directly from within Notepad II.
     
  7. Bunford

    Bunford Audiosexual

    Joined:
    Jan 17, 2012
    Messages:
    2,392
    Likes Received:
    934
    The problem, from memory, is that Windows by default opens the hosts file with Notepad and then saves your edited version as a .txt file. What I always do is:
    1. Download the portable version of Notepad++ and install wherever you want (I normally stick it in my Document folder within a Notepad++ folder.
    2. Copy the original hosts file, paste into same location, and rename the copy as hosts.BAK and then this serves as your backup to fall back to if ever needed.
    3. Right click on the original hosts file and make sure "Read only" is de-selected.
    4. Right click on the original hosts file and choose "Open with..." and then select choose other programme, navigate to your Notepad++ .exe file and select it.
    5. Hosts now opens in Notepad++ and make your edits
    6. Select "Save" and it will tell you that you need admin right and asks if you want to relaunch Notepad++ with admin RIGHTS. Select "Yes".
    7. Once relaunched, click "Save" again to save using admin rights.
    8. Close Notepad++.
    9. Right click on original hosts file and re-select "Read only"
    10. Done
    TIP: You can right click on the Notepad++ .exe file in the location you placed the portable version, select "Properties" and make it always run as admin. This will save having to do the relaunch step (but it only take a second to relaunch anyway).
     
  8. r4e

    r4e Audiosexual

    Joined:
    Sep 6, 2014
    Messages:
    857
    Likes Received:
    1,223
    Easiest way is to run Notepad as admin and then hit "ctrl + o" or "file -> open" to open the hosts file.
     
  9. Benno de Bruin

    Benno de Bruin Kapellmeister

    Joined:
    Nov 11, 2020
    Messages:
    99
    Likes Received:
    49
    Search for Notepad.
    Run as Administrator, at the right.
    Navigate to the hosts file and open it (set Open dialog to All files).
    Edit the file and use [Save] from the menu.
     
  10. Frunkenstein

    Frunkenstein Noisemaker

    Joined:
    Feb 2, 2024
    Messages:
    7
    Likes Received:
    4
    Thanks for the replies. Some of the replies I sense did not exactly read my original post, because it's a bit of a conundrum to keep reading the SAME instructions I have diligently googled and followed now for hours. I do appreciate the help tho!

    To restate: I am copying and pasting the hosts file to my desktop. I am opening Notepad as administrator. I am opening the hosts file, editing, and saving it as a file (not .txt). I am dragging and replacing the file back into the /etc folder. It asks me for admin permissions. I say yes. It starts to copy over, all is going well. This should be it. But it's not.

    After it is finished copying, I get this: Destination folder access denied. You need permissions to perform this action. (and it shows an icon of the /etc folder) The dialog gives me two buttons, "try again" or "cancel." That's it.

    I've tried directly editing the hosts file in the folder. It won't save as or overwrite the file, and yes I am opening up Notepad as administrator. I do not have the option to "take ownership of the context menu" in my menus.

    I am dumbfounded that every article I read, video I watch, or reply in this thread is making me feel like I am running some "special fake version of Windows were all the options are different."

    I feel like I am taking crazy pills! I appreciate the help and being patient with me, I really am following instructions to a "t" and it's just not working because of this "additional dialog/denial" I am really perplexed how I am not reading a single sentence across the wide web of anyone else mentioning this being a thing preventing you from editing the hosts file. It's incredible. I'm not a Windows person and haven't tinkered with any anti-virus or setup anything special so just, wow.... This should be simple, I know! haha
     
  11. Moofus

    Moofus Ultrasonic

    Joined:
    Jul 8, 2023
    Messages:
    55
    Likes Received:
    35
    Location:
    Glasgow, Scotland
    try this for a different approach:
    run cmd as admin from start menu
    type cd drivers/etc
    type notepad hosts
    edit it
    Save it

    And if that does not work, hold shift and click restart. Go into recovery - advanced and open a command prompt and try it there.

    If it takes that, then your windows account has been altered in some way and is not providing proper administrator powers. Running command prompt from recovery as above is usually a way to do things without hitting all the user priveledges issues.
     
  12. AstralDis

    AstralDis Producer

    Joined:
    Sep 13, 2019
    Messages:
    185
    Likes Received:
    89
    if you use Zone Alarm, it blocks editing of your hosts file by default. There is a section to uncheck it.
    Just in case you do use ZA...
     
  13. bluerover

    bluerover Audiosexual

    Joined:
    May 3, 2013
    Messages:
    1,283
    Likes Received:
    1,145
    Just use this awesome portable freeware utility : (app will minimize to the SYSTRAY)
    https://www.sordum.org/downloads/?bluelife-host-editor

    SORDUM takes care of all the BS work, locking, permissions, etc. It'll even turn it on and off, e.g. if you need to get around a pesky R2R host file entry to get to the LINE6 website to download some hardware drivers, for example.
     
  14. Will Kweks

    Will Kweks Platinum Record

    Joined:
    Oct 31, 2023
    Messages:
    418
    Likes Received:
    237
    I use the Windows Powertoys' "Hosts file editor", handles multiple files, permissions, tests for validity and does backups.

    But then again I find Powertoys to be invaluable in any Windows system anyway.
     
  15. Frunkenstein

    Frunkenstein Noisemaker

    Joined:
    Feb 2, 2024
    Messages:
    7
    Likes Received:
    4
    Not using anything. It's a plain Windows 11 pro install.

    I will google and look into this next.

    I explained I didn't want to download powertoys because of all the bloat it comes with that I will never use, but I actually got to the point of downloading and installing it. Guess what? It doesn't work... OMG right? Every time I edit the file, it stalls up for 30 seconds, then says "cannot save the hosts file as it is in use."

    Unbelievable. I swear I haven't done anything to this Win 11 install other than install the damn OS a year and a half ago. No anti-virus trials or the like, no silly things installed. In fact, I'm really only trying to edit the hosts file to block Microsoft trackers that I learned about and annoy the ever living shit out of me after learning about them haha.
     
  16. clone

    clone Audiosexual

    Joined:
    Feb 5, 2021
    Messages:
    6,971
    Likes Received:
    3,046
    Can't you boot into safe mode as an admin account? You can grab one of those hosts files posted here with nearly every dev website already blocked. What about booting to Command line and then just swapping the file from disk?

    Isn't all the Microsoft bloat, trackers, and BS removed from Windows builds like Oprekin, x-lite, and others?

    How about throwing your favorite linux onto a flash drive via Unetbootin, booting the machine and then accessing the windows 11 files? https://unetbootin.github.io

    Hirens? https://www.hirensbootcd.org/usb-booting/
     
    Last edited: Jun 20, 2024
  17. bluerover

    bluerover Audiosexual

    Joined:
    May 3, 2013
    Messages:
    1,283
    Likes Received:
    1,145
    Once you figure out your problem, highly recommended to visit this website and paste this 0.0.0.0 version into your every-day-internet driver PC's host file. This has saved my ass from some accidental ransomware incidents a few times.
    https://someonewhocares.org/hosts/zero/

    I forgot to add that this is another great HOSTS editor :
    https://www.abelhadigital.com/hostsman/
     
    Last edited: Jun 20, 2024
  18. clone

    clone Audiosexual

    Joined:
    Feb 5, 2021
    Messages:
    6,971
    Likes Received:
    3,046
    That's the one. There are some others on Github which are good too (just compilations of the same ones). But you still need to add all the audio devs to them. Those are mostly for stuff an average user will encounter; not for ET phoning home.
     
  19. stopped

    stopped Producer

    Joined:
    Mar 22, 2016
    Messages:
    421
    Likes Received:
    134
    Best Answer
    I didn't realize tinywall did this as well until I wasted 5 minutes confused when the sister site was having dns issues a couple weeks ago.
    If something is locking your hosts file open (you'll get a 'file in use' error when you try to save) and you can't figure out what it is, the program 'process explorer' will tell you what has it open
     
    • Like Like x 1
    • Agree Agree x 1
    • List
  20. Frunkenstein

    Frunkenstein Noisemaker

    Joined:
    Feb 2, 2024
    Messages:
    7
    Likes Received:
    4
    THAT WAS IT! OMG OMG OMG hahaha

    I thought tinywall was just a small, clean, simple internet cockblocker. I saw it running after checking task manager, even after I "exited the program," so I ended task from there, and it just instantly relaunched. I was like "da fuq" and I opened tinywall to look at it's settings to change that behavior, and BOOM there it was; "prevent modifications to hosts file." That was it. I can now edit my hosts file like a normal person.

    That was like 8 hours of "but why tho??" lmao. Thanks to everyone for the help and being patient with an idiot like me. Topic SOLVED.
     
  21. stopped

    stopped Producer

    Joined:
    Mar 22, 2016
    Messages:
    421
    Likes Received:
    134
    it totally took me 3x longer to figure out how to make it stop blocking the hosts file than I spent figuring out what was blocking it
    I'm glad a google search told me there was a config setting before I followed through editing the permissions of the service in the registry lol
     
Loading...
Loading...