Ubuntu ignoring /etc/hosts file 10.04
I'm trying to use the /etc/hosts file for adblocking, but both firefox and opera seem to ignore it on my setup. I've messed around with this install a bit, but nothing with the networking.
I've searched the forums for a few reasons this might be happening - I've verified that the permissions on hosts and nsswitch.conf file allow them to be read by everyone (644).
I can successfully ping localhost, if that matters.
My hosts file looks like this, truncated of course, and it terminates in a blank line. The blank line didn't make a difference, but I read a post that suggested it would, so I added that. I also added the third entry 'test' just to verify that the hosts file wasn't being looked at at all, and it was unable to resolve through ping.
Quote:
127.0.0.1 localhost
127.0.1.1 inazuma-desktop
127.0.0.1 test
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
#start of lines added by WinHelp2002
# [Misc A - Z]
127.0.0.1 fr.a2dfp.net
127.0.0.1 m.fr.a2dfp.net
127.0.0.1 ad.a8.net
127.0.0.1 asy.a8ww.net
127.0.0.1 abcstats.com
127.0.0.1 a.abv.bg
The contents of my nsswitch.conf
Quote:
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat
group: compat
shadow: compat
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
resolv.conf
Quote:
# Generated by NetworkManager
domain austin.rr.com
search austin.rr.com
nameserver 192.168.0.1
hosts.conf
Quote:
# The "order" line is only used by old versions of the C library.
order hosts,bind
multi on
I'm a newbie to all of this, all the above information I got from searching the forums for this same request.. none of the resolutions I found helped me, though. If anyone has any ideas on how to fix this, please let me know!
Re: Ubuntu ignoring /etc/hosts file 10.04
Another suggestion would be to install adblock plugin in firefox
Re: Ubuntu ignoring /etc/hosts file 10.04
I don't want to use firefox; if and when I do I'd still like to be able to use the hosts file for an added layer of security. Any ideas on why my system isn't using the hosts file?
Re: Ubuntu ignoring /etc/hosts file 10.04
I'm still having this problem. I've read since I posted that if I have windows carriage returns in the file it could keep it from being read properly.. is there a way I can check to see if that's the case?
Re: Ubuntu ignoring /etc/hosts file 10.04
Open the file using gedit
Code:
gksudo gedit /etc/hosts
and then choose 'File'->'Save As'. In the dialog box that opens look along the bottom line and see 'encoding' and 'line-ending' options ->choose-> "Current Locale ()" & "Unix/Linux" and then click the 'save' button.
Does that make the difference?
You may need to close your browser (check "System"->"Administration"->"System Monitor"=>"Processes" to make sure it quit) and then re-open to clear it's DNS cache.
Re: Ubuntu ignoring /etc/hosts file 10.04
Now that's interesting.. navigating to the file by selecting the partition, then /etc , and then 'hosts' gives me my file as I expected to see it, while gksudo gedit /etc/hosts gave me the unedited file! I completely restarted my system since I made the change, and I was certain it had been saved.. in fact, through the file browser, it still shows the size at 600 k.
Editing the file through that view, I was able to add the test line and it pinged fine, and adding my adblocking entries there worked.
Now I'm really stumped though! I've left different entries in both files to verify they are different, and they are.. the hosts file I reached through the command lines entries work, the ones I reached through the GUI do not.
ANY idea why that might be?
Re: Ubuntu ignoring /etc/hosts file 10.04
I can only suggest that perhaps you have an extra partition with an /etc in it :)
How/where are you selecting this partition you speak of?
Re: Ubuntu ignoring /etc/hosts file 10.04
Yeeeep, that's the case. Of all the things I looked at.. that was it. Thanks for the help!
Re: Ubuntu ignoring /etc/hosts file 10.04
Quote:
Originally Posted by
robsoles
I can only suggest that perhaps you have an extra partition with an /etc in it :)
How/where are you selecting this partition you speak of?
Rob this response you gave another user closely resembles my problem. I open terminal window and type sudo gedit /ect/hosts to add a line. When gedit opens it is a blank page. I'm wondering if maybe this is because I run a dual boot system with winXP. If I have to direct the command to the partition and then the file system of Ubuntu I'm going to need help as I've never done this. I'm just trying to add a line for the iesnare mpsnare, but so far haven't found any advice that will make the edit work.
Re: Ubuntu ignoring /etc/hosts file 10.04
Quote:
Originally Posted by
LoneWolf218
...
I open terminal window and type sudo gedit /ect/hosts to add a line. When gedit opens it is a blank page...
Try /etc/hosts.