Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

up vote 10 down vote accepted

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.

share|improve this answer
    
you so saved me, thanks for your help –  chris Dec 29 '11 at 9:04
    
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. –  Fronker Jul 1 '12 at 8:37
    
+1 for keyboard shortcut –  gronostaj Mar 11 '13 at 18:10
  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'.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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