i can't modified the host file.

G

Guest

i tried to modified to add IP local host on my system. but there is an error
message prompt "Cannot create the C:\Windows\System32\drivers\etc\hosts
file." - "Make sure that the path and filename are correct"

How to solve this?

PJ
 
M

Malke

P.J. said:
i tried to modified to add IP local host on my system. but there is an error
message prompt "Cannot create the C:\Windows\System32\drivers\etc\hosts
file." - "Make sure that the path and filename are correct"

How to solve this?

PJ

I have some notes on doing this from a newsletter by Mark Minasi:

"The HOSTS file is in the same place that it's always been in Windows:
\windows\system32\drivers\etc. But that directory has a different set
of NTFS permissions than Windows has ever seen, as by default
administrators can't delete files, nor do they own those files. You can
give yourself enough control of HOSTS to modify it by first taking
ownership of it, then granting yourself full control to HOSTS. That's
most easily done from an elevated command prompt.

"(Note: an "elevated command prompt" means that you right-click the
Command Prompt icon and choose "Run as administrator," and then click
"Confirm" when you get the User Account Control prompt.)

"From the elevated command prompt, type these two lines:

takeown /f c:\windows\system32\drivers\etc\hosts
icacls c:\windows\system32\drivers\etc\hosts /grant yourusername:f

"Those are two new Vista command-line tools. The first lets you take
ownership of a file or folder, as its name suggests. That line that you
typed is the simplest form of takeown: just add a "/f" and the name of
the file or folder to take ownership of. (Takeown even lets you take
ownership of things on remote systems, which can be convenient.) The
second command lets you adjust NTFS permissions and file/folder
integrity levels -- it's intended to be the replacement for cacls, which
has been around since NT 3.1, and its syntax closely mirrors cacls's.
In that command, I'm using the /grant option to allow me to give the
account "yourusername" full control; that's what the "F" stands for."

Hope that helps,


Malke
 
M

Michael

Run notepad 'as administrator'
open the file, make changes and save.

Making the changes in notepad for instance without elevating to 'run as
administrator' gives the error message you report.

Michael
Vista home premium
 
G

Guest

Thanks GUYS, it works!

Malke said:
I have some notes on doing this from a newsletter by Mark Minasi:

"The HOSTS file is in the same place that it's always been in Windows:
\windows\system32\drivers\etc. But that directory has a different set
of NTFS permissions than Windows has ever seen, as by default
administrators can't delete files, nor do they own those files. You can
give yourself enough control of HOSTS to modify it by first taking
ownership of it, then granting yourself full control to HOSTS. That's
most easily done from an elevated command prompt.

"(Note: an "elevated command prompt" means that you right-click the
Command Prompt icon and choose "Run as administrator," and then click
"Confirm" when you get the User Account Control prompt.)

"From the elevated command prompt, type these two lines:

takeown /f c:\windows\system32\drivers\etc\hosts
icacls c:\windows\system32\drivers\etc\hosts /grant yourusername:f

"Those are two new Vista command-line tools. The first lets you take
ownership of a file or folder, as its name suggests. That line that you
typed is the simplest form of takeown: just add a "/f" and the name of
the file or folder to take ownership of. (Takeown even lets you take
ownership of things on remote systems, which can be convenient.) The
second command lets you adjust NTFS permissions and file/folder
integrity levels -- it's intended to be the replacement for cacls, which
has been around since NT 3.1, and its syntax closely mirrors cacls's.
In that command, I'm using the /grant option to allow me to give the
account "yourusername" full control; that's what the "F" stands for."

Hope that helps,


Malke
--
Elephant Boy Computers
www.elephantboycomputers.com
"Don't Panic!"
MS-MVP Windows - Shell/User
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top