“I’m trying to create a lmhosts file on my Windows 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 computer?”
Starting way back with Windows Vista, one of the security measures Microsoft took to protect Windows from malware was to make it harder to edit the lmhosts and hosts file. In older versions of Windows, malicious code would modify these files, which caused your computer to redirect you to websites you didn’t intend to see or potentially used your computer for other malicious purposes you didn’t intend. With the improved security, you need administrator privileges to open lmhosts and edit the files, which takes an extra step beyond signing in as an administrator account.
Assuming you are an administrator account when you are logged in, these steps should work to open lmhosts and 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.