PDA

View Full Version : Windows 7 hosts file


mad_jock
14th Oct 2010, 22:55
Just tried to stick some entrys in my hosts file in windows 7 Home premium.

What a stupid pain in the backside system for editing system files.

I am logged in as admin can I edit them NO

I have to run as administrator notebook

Does this allow me to edit them NO

After 40 mins fiddling with the file permissions I eventually get to save the hosts file I want.

And thats another thing the hosts file in etc doesn't work

you have to go to

C:\Windows\winsxs\amd64_microsoft-windows-w..nfrastructure-other_31bf3856ad364e35_6.1.7600.16385_none_6079f415110c0210

and modify the hosts file in that.

I had been quite happy with windows 7 but what a bloody PITA.

gizmocat
14th Oct 2010, 23:27
Agreed :sad:

mad_jock
14th Oct 2010, 23:32
Well I have found out that what I thought was an administrator account actually isn't!!!!

Logon to Windows 7 using your usual account.
Launch the cmd prompt - Make sure you select, 'Run as administrator'
Net user administrator p$ssw0rD
Net user administrator /active:yes
Switch User, or logoff
Logon as Administrator Password p$ssw0rD
(Your password may be different!)


Seems what you think is an admin account is really just a user account with sudo rights on certain commands.

Mike-Bracknell
15th Oct 2010, 00:08
I would applaud anything which meant it was harder to edit hosts files rather than easier.

This is because I recommend heavily against doing it, and only choose it as a method of last resort due to the possibility that it can create a world of pain from a troubleshooting perspective when 6 months down the line you've forgotten you've edited the file (or someone else is editing the computer) and the hosts file entry rears it's ugly head.

Much better to either use a DNS server somewhere, or to use IP addresses.

Tarq57
15th Oct 2010, 04:09
Never had a problem using the MVPS hosts file in XP.

Stops a lot of ads, as well as known dodgy sites, too. Always worked flawlessly for me.

Can't wait till support is withdrawn for XP...not!

green granite
15th Oct 2010, 06:13
Only ever edited hosts in the regular "etc" location - by right click in Notepad and run as Admin. Works for me. (Windows 7 x64).

Yep, works for me too.

mad_jock
15th Oct 2010, 08:35
Well apparently it doesn't work that one in etc and from my experence it doesn't.

Its in there but if you then try and ping the address it still goes to the dns server and as my local dns server seems to spend more time down than up and there is a bad route to the one I usually use.

Its quite well documented on the web it doesn't do anything.

Normally I would agree with you Mike but its just an entry with pprune and my mail server for when the local DNS server isn't playing ball and there is no route to the one I usually use.

The administrator account though Its very useful to know about. I know its done to protect the user but it makes life so much easier when you use it instead of that sudo account.

Bushfiva
15th Oct 2010, 10:06
sudo

xkcd: Sandwich (http://xkcd.com/149/)

Mike-Bracknell
15th Oct 2010, 12:56
You did remove the .sam file suffix from "hosts" to leave it as an unsuffixed file, didn't you?

As Windows ships, there's a hosts.sam and an lmhosts.sam which are sample files with sample entries that you need to edit and then rename to remove the .sam (which you'll only see if you've got the folder options set not to hide extensions for known file types.....which is another bugbear!)

mad_jock
15th Oct 2010, 13:20
Just doubled checked and its just plain hosts.

In fact just deleted the changes in hosts in /etc and it still resolves it when I screw with the DNS server settings. So there is something a bit strange going on.

Why can't it be as simple as

# vi hosts

insert
67.201.16.181 www.pprune.org
esc
:wq

Mike-Bracknell
15th Oct 2010, 18:46
It depends on how your client is set up as to how it decides it's node-type (and hence what hierarchy it uses to resolve names).

I'm going from memory here, but...

If you specifically state DHCP option 46, it'll choose this, but if you don't then it looks at whether you have things like WINS and DNS servers configured, and whether you have a dynamic or static IP address.

A node-type of 0x8 is the best choice IMHO, which gives you name resolution via DNS then WINS then broadcast then hosts then lmhosts, but others are possible.

WINS is deprecated as of Windows 2000 onwards anyway, so you really shouldn't be using that any more, and should remove any WINS servers from your network (and the associated settings in your TCP/IP stack).

Just done a google, and you can manually set the node type in the registry, which might solve your specific issue (not that i'd advocate that normally):

Network Uptime: Troubleshooting WINS Broadcasts (http://www.networkuptime.com/archives/2001/08/troubleshooting.html)

mad_jock
15th Oct 2010, 19:08
I haven't managed to find those options yet if they give you them at all in the sodding point and click system.

Anyway now I have that administrator account and downloaded the spreadsheet with all the reg entrys that the group policy snap in would tinker with if it was installed I can beat the sod into doing what I want it to do.

Its still a screwed up method of doing things though.

Mike-Bracknell
15th Oct 2010, 19:34
Its still a screwed up method of doing things though.

No argument here. Bring back win.ini and system.ini, and make programs totally modular and 'fork-liftable' :ok:

Saab Dastard
15th Oct 2010, 20:33
MJ,

Did you flush the DNS cache?

Default name resolution for Win2K+ is:

1. Checks it is own name.
2. Local cache.
3. HOSTS file
4. It will then suffix the Search Suffix configured on the machine, then query DNS
5. WINS
6. Broadcast
7. LMHOSTS

SD

mad_jock
15th Oct 2010, 20:40
Aye I did.

It seems all a bit bizarre.

I have a feeling that the home editions have been screwed around with to the point of taking the piss.

I have nothing in the hosts file in /etc the DNS server is down and only have an entry in that other hosts file and it resloves pprune, if I swap it to to /etc it can't resolve pprune.

O aye I am linking into the internet using a 3g network so that abortion of a network killer wins isn't in the frame.

Keef
15th Oct 2010, 22:02
I've never had a problem editing /hosts on either Win 7 machine, but I did have to change some settings to get the machine to allow me to.

I use hosts as a belt-and-braces to stop the worst of the infected sites. There's a handy ready-sliced hosts file available to download from here (http://www.mvps.org/winhelp2002/hosts.zip).

mad_jock
15th Oct 2010, 22:16
What version have you got keef?

Keef
15th Oct 2010, 23:39
Winhelp 2002? It's the January 2010 version. I've not bothered to update it since.

mad_jock
16th Oct 2010, 03:04
No the version of Windows 7 Basic, Premuim,Pro or Ultimate.