how to allow certain program to access my hosts file

Usama N. Helmy 21 Reputation points
2020-11-18T05:43:48.463+00:00

hello, I have a program that gets this error upon starting it: access to the path 'c:\windows\system32\drivers\etc\hosts' is denied
how can I allow it to access hosts?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,664 questions
{count} votes

Accepted answer
  1. Andreas Baumgarten 97,076 Reputation points MVP
    2020-11-18T09:52:10.68+00:00

    By default the users group of the Windows 10 computer should have read access to the hosts file.
    If your program/user needs write access you have to modify the ACL of the hosts file.

    40568-hostsacl1.jpg

    40578-hostsacl2.jpg

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Tim Roberts 81 Reputation points
    2020-11-18T20:02:13.647+00:00

    REMEMBER that the "system32" directory is subject to file system redirection. If you try to read that file from a 32-bit process, you will instead get "c:\windows\syswow64\drivers\etc\hosts", which does not exist.

    If you are trying this from a 32-bit process, use "sysnative" instead of "system32".

    0 comments No comments

  2. Usama N. Helmy 21 Reputation points
    2020-11-20T02:51:40.377+00:00

    thank you guys, I tried the security tab in properties but didn't help, then I tried unchecking the READ ONLY from properties and it worked fine..

    I removed avast and windows security essentials, but the solution was so much simpler than I thought lol

    0 comments No comments