Geeks With Blogs

Tim Huffam Dotting the I and crossing the T of I.T.

Windows Vista Home edition has some funny quirks - and this one is a prime example...

When trying to update my hosts file I get permission denied.  That's odd - so I check the permissions and sure enough Administrator group has write access - yet I am the only administror on the system.   How's that for tricky - so I'm an admin with no admin rights - go figure.  Then I tried deleting the file then readding it....  wow - delete worked but could not re-add.

It appears the only way around this little gem is to turn off user access control (not recommended - but there seems to be no other option as the security is fairly random and not what it used to be in earlier verisons of windows).

To do this go into Control Panel, select User Accounts then choose "Turn User Account Control On or Off" and turn it off (uncheck the checkbox then click OK) - you'll need to reboot for this to take effect.

Now you can change the files.

*** Just remember to undo the security by-pass - but turning back on the user access control (same as above - checking the checkbox). ***

**** Updated: As Joe suggests below - yes the correct way would be to start your editor by using right-click - 'Run as administrator'.  However this still does not explain the bug with Vista's security model that does not allow an admin user to update the hosts file without turning off UAC.

HTH

Tim

Posted on Sunday, February 1, 2009 9:38 PM OS/Networking/Misc Apps , Half Baked | Back to top


Comments on this post: How to change permissions on Vista Home so you can update your hosts file

# re: How to change permissions on Vista Home so you can update your hosts file
Requesting Gravatar...
First problem: You should not be running as a user that is a member of the administrators group.

Second problem: You should not be turning off UAC.

If you edit the HOSTS file using the Administrator account, you would have not had any trouble.

If you continue to run Windows as a local user that is a member of the Administrators group, then the next time you want to edit the HOSTS file, do this:

C:>runas /user:Administrator notepad

Now you can edit the hosts file just fine. You can accomplish this same thing by navigating to Notepad in the start menu, right-click, choose “Run as Administrator” if you don’t like the command line thing.

If you want to understand what is going on, then read up on security rights elevation (and de-elevation) in Windows. If you run your system “the right way”, you will never run into this issue or to UAC. The “right” way is use a Normal User account for everyday tasks, and whenever you want to do something like install software or edit a hosts file, logoff and back on as the administrator. Just remember to switch back to your account before doing anything else (such as surf the web). With "switch user", this is not really a burden, and frees you from much more burdensome tasks like keeping anti-virus up to date.
Left by Joe on Feb 02, 2009 1:48 AM

# re: How to change permissions on Vista Home so you can update your hosts file
Requesting Gravatar...
This is lovely. Used to do not really be aware that Cover to keep up this. My spouse and i continued a person's contact plus tested this type of throughout it all succeeds very. I`m so fortuitous which I recently found your site.
Many thanks.
Left by Android Instagram on Apr 10, 2012 4:49 PM

# re: How to change permissions on Vista Home so you can update your hosts file
Requesting Gravatar...
Right is the code that I'm looking for thank you for sharing hope to have more sharing!
Left by giay nam on Jan 23, 2013 7:30 AM

Your comment:
 (will show your gravatar)


Copyright © Tim Huffam | Powered by: GeeksWithBlogs.net