4

I am running Windows 7 Home Edition on my laptop.

I also have an instance of Apache Server running and am trying to create a virtual directory. I have updated apache's vhost-httpd file and now need to update C:\Windows\System32\drivers\etc\hosts. But I don't have permissions.

How do I get permission for this?

10

If you are editing the hosts file, you'll need to do two things.

Make sure your account is an admin account. If it is the only account on your computer, then it will 99% likely be an admin account.

open the start menu and type notepad c:\windows\system32\drivers\etc\hosts then hit ctrl shift Enter. This should raise a UAC prompt. If it didn't, do it again.

That should run Notepad elevated and allow you to edit the hosts file. Exit and save.

  • Surprisingly, I couldn't find a previous question about editing the host file. . . – surfasb Dec 29 '11 at 9:34
  • A third thing you may have to do is temporarily disable your Virus checker. The most recent Version of Avira at least blocked me from writing to hosts. And made it look like I had a file access rights issue. – Frank Nocke Jul 1 '12 at 8:37
  • The best and only anti-virus option IMO is Microsoft's Security Essentials – surfasb Jun 8 '15 at 18:24
4

When I tried to do so, I found the same problem. The thing is, when you try to edit it with Notepad, when you try to save you don't have permissions. Best solution is:

  1. Open Notepad with Admin permissions
  2. Using File->Open from Notepad, browse to hosts

Then you should be able to edit and save it.

1

One thing to remember about Windows 7 is that any file you want to edit in the C:\Windows folder, will require administrative permissions. Another good way is to open Windows Explorer with admin privileges (search for it in the Start Menu, right-click -> Run as administrator). This way, all files you open from Windows Explorer are opened with admin rights and can be edited and saved back.

Whatever you do, do not disable UAC. Even though it can annoy you at times, it is an important security feature which makes Windows 7 safer than Windows XP ever was.

0
  1. Open Notepad with Admin permissions
  2. Using File->Open from Notepad, browse to hosts

After performing the above steps, and while saving the file, it throws me an error message saying 'you dont have the privilege to make any changes. please contact admin'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.