Resources > Windows 7 Q&A > How to edit Windows 7 lmhosts file

How to edit Windows 7 lmhosts file

Question:

“I’m trying to create a lmhosts file on my Windows 7 computer but I keep getting an error message that says Access to C:\Windows\System32\ drivers\etc\lmhosts.sam was denied. How can I edit lmhosts.sam so that I can create an lmhosts file on my Windows 7 computer?”

Answer:

One of the security measures Microsoft
took to protect Windows Vista and Windows 7 from malware was to make it harder to edit the lmhosts and hosts file. You need administrator privileges to edit the files, which takes an extra step than being an administrator account.

Assuming you are an administrator account when you are logged in, these steps should work to edit your lmhosts.sam file. First, open Notepad by right clicking on the application icon and choosing run as administrator. If you don’t run Notepad as administrator, you won’t be able to edit lmhosts.sam.

Next open the lmhosts.sam file in Notepad. The lmhosts.sam file is located in:
C:\Windows\System32\drivers\etc or if your system hard drive isn’t C: the path is whatever your system path would be: %systemroot%\Windows\System32\drivers\etc

Once you open the file, simply modify the lines you need for the IP addresses you want to map to network names in the pattern IP address first network name second. So if you wanted to hardcode a resource named Jake in your lmhosts file, you would add the line:
192.168.1.108 Jake

Save the file as lmhosts (without the .sam) and your change will instantly be active.

Leave a Comment


seven − 2 =


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>