How to block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
User avatar
catweazel
Level 19
Level 19
Posts: 9751
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

How to block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by catweazel » Sat Oct 21, 2017 9:13 pm

Your hosts file sits in /etc/hosts and probably looks like this:

Code: Select all

127.0.0.1       localhost
127.0.1.1       Fenella

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Give it a huge upgrade to stop web-nasties by opening this link and copy everything from this line onwards:

Code: Select all

# [Start of entries generated by MVPS HOSTS]
In a terminal, sudo nano -w /etc/hosts and paste the text at the end of the file.

ctrl-o, enter to save, then ctrl-x to exit.

All done.

The file is updated regularly so if web security is important to you, check the link every month for updates.

If you'd like to know more, see this link. It's Windwoes oriented but it'll give you a good idea of what's going on.

Edit: To automate the download process and the update of the hosts file, see this link. Thanks to user majpooper for the tip.
Last edited by catweazel on Tue Oct 24, 2017 2:24 am, edited 2 times in total.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.

User avatar
sammiev
Level 4
Level 4
Posts: 370
Joined: Sat May 19, 2012 12:16 pm

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by sammiev » Sat Oct 21, 2017 10:40 pm

Thanks testing it now.

Resistor
Level 4
Level 4
Posts: 208
Joined: Wed Nov 03, 2010 12:04 am
Location: Western Ozarks

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by Resistor » Sun Oct 22, 2017 5:20 pm

Thanks, catweazel.

I've often wondered how it worked in Linux.
Do we need to do anything with the other Host files?
Dell Inspiron 15-7567 Gaming Laptop i5, 8GB Ram, 256GB SSD. Win 10 reduced partition. Nvidia GeForce GTX 1050 Ti. LM 19.1 + 19.2 Cinnamon
Dell Inspiron 15Z, i3, 6 GB RAM. Win 8 is gone. LM 19.1 + 19.2 Cinnamon

User avatar
catweazel
Level 19
Level 19
Posts: 9751
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by catweazel » Mon Oct 23, 2017 12:57 am

Resistor wrote:Do we need to do anything with the other Host files?
No.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.

User avatar
Pierre
Level 19
Level 19
Posts: 9179
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by Pierre » Mon Oct 23, 2017 1:03 am

these type of Host File Lists are useful, but you do need to constantly update them . .

other folks just use a browser add-on like No Script to do the job.
& there is nothing wrong with the "belt & braces" approach, either.
8)
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.

Resistor
Level 4
Level 4
Posts: 208
Joined: Wed Nov 03, 2010 12:04 am
Location: Western Ozarks

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by Resistor » Mon Oct 23, 2017 1:03 am

I appreciate the insight, catweazel.
I know more now, than I did on Saturday... :mrgreen:
Dell Inspiron 15-7567 Gaming Laptop i5, 8GB Ram, 256GB SSD. Win 10 reduced partition. Nvidia GeForce GTX 1050 Ti. LM 19.1 + 19.2 Cinnamon
Dell Inspiron 15Z, i3, 6 GB RAM. Win 8 is gone. LM 19.1 + 19.2 Cinnamon

Resistor
Level 4
Level 4
Posts: 208
Joined: Wed Nov 03, 2010 12:04 am
Location: Western Ozarks

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by Resistor » Mon Oct 23, 2017 1:07 am

Pierre wrote:these type of Host File Lists are useful, but you do need to constantly update them . .

other folks just use a browser add-on like No Script to do the job.
& there is nothing wrong with the "belt & braces" approach, either.
8)
That be me... belt & braces.
I'm glad to no longer be running with a largely useless hosts file.
It has been a long time...
Dell Inspiron 15-7567 Gaming Laptop i5, 8GB Ram, 256GB SSD. Win 10 reduced partition. Nvidia GeForce GTX 1050 Ti. LM 19.1 + 19.2 Cinnamon
Dell Inspiron 15Z, i3, 6 GB RAM. Win 8 is gone. LM 19.1 + 19.2 Cinnamon

Aleron Ives
Level 3
Level 3
Posts: 124
Joined: Sun Sep 17, 2017 2:20 am
Location: California
Contact:

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by Aleron Ives » Mon Oct 23, 2017 4:47 am

Manually pasting this into your hosts file every month seems rather inelegant, but I guess it is the most straightforward and cross-platform-friendly solution if MVPs doesn't want to ask people to run extra peerblocking software.

User avatar
catweazel
Level 19
Level 19
Posts: 9751
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by catweazel » Mon Oct 23, 2017 4:55 am

Aleron Ives wrote:Manually pasting this into your hosts file every month seems rather inelegant
catweazel wrote:To automate the download process and the update of the hosts file, see this link.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.

Aleron Ives
Level 3
Level 3
Posts: 124
Joined: Sun Sep 17, 2017 2:20 am
Location: California
Contact:

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by Aleron Ives » Mon Oct 23, 2017 5:00 am

I guess I should have chosen my words more carefully. Using your hosts file for this purpose seems rather inelegant. :wink:

User avatar
catweazel
Level 19
Level 19
Posts: 9751
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by catweazel » Mon Oct 23, 2017 5:14 am

Aleron Ives wrote:Using your hosts file for this purpose seems rather inelegant. :wink:
<shrug>
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.

User avatar
Moem
Level 19
Level 19
Posts: 9553
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by Moem » Mon Oct 23, 2017 6:21 am

I don't see what's inelegant about it. If you already know you aren't interested in a certain portion of what the internet offers, why not simply deny it entry to your computer?
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!

Aleron Ives
Level 3
Level 3
Posts: 124
Joined: Sun Sep 17, 2017 2:20 am
Location: California
Contact:

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by Aleron Ives » Mon Oct 23, 2017 7:03 am

I was under the impression that the hosts file was intended for addresses that DNS can't resolve, e.g. the hostnames of the machines on your LAN, so you can access them easily. This seems like a task best suited to browser-based blocking software, where you could use features such as analytics to see which filters are being used frequently and to prune filters that have no hits to speed up the process of checking the blocklist on each page you visit. I'm not really sure how you would expect these entities to be accessing your PC other than through a browser, so globally blocking them in a manner that gives no feedback as to the efficacy of each filter seems a bit heavy handed an inefficient IMHO. Am I missing some added benefit of doing it this way?

User avatar
Moem
Level 19
Level 19
Posts: 9553
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by Moem » Mon Oct 23, 2017 8:15 am

It's easy. Set it and forget it. I can see why you'd call it 'heavy handed', but 'inefficient'... no. It works very well and there is very little effort, how can it be inefficient?
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!

User avatar
Flemur
Level 17
Level 17
Posts: 7333
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by Flemur » Mon Oct 23, 2017 2:20 pm

I used to use the 'hosts' file but it doesn't support wild-cards; 'privoxy' is a lot easier once you get it set up.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?

syg00
Level 4
Level 4
Posts: 211
Joined: Fri Jul 21, 2017 4:00 am

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by syg00 » Mon Oct 23, 2017 8:22 pm

Very last century. I park a pi3 as a getway/router so the entire house can be protected without having to constantly update each machine individually.

Each to their own.

User avatar
majpooper
Level 5
Level 5
Posts: 960
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by majpooper » Mon Oct 23, 2017 9:16 pm

A very simple script and a cron and you are done - what's the big deal?

User avatar
sammiev
Level 4
Level 4
Posts: 370
Joined: Sat May 19, 2012 12:16 pm

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by sammiev » Mon Oct 23, 2017 9:33 pm

I did setup a script and cron job to run each day but you can also setup to receive an email when a update to the hosts file is updated.

Then run the script as required than each day. It seems last update was mid Sept.

Just saying.

http://winhelp2002.mvps.org/updates.htm

User avatar
catweazel
Level 19
Level 19
Posts: 9751
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by catweazel » Tue Oct 24, 2017 1:41 am

Aleron Ives wrote:I was under the impression that the hosts file was intended for addresses that DNS can't resolve
Clearly it's also intended for addresses you don't want to resolve.
Aleron Ives wrote:This seems like a task best suited to browser-based blocking software, where you could use features such as analytics to see which filters are being used frequently and to prune filters that have no hits to speed up the process of checking the blocklist on each page you visit.
Nonsense. The file is loaded and the list checked in microseconds flat.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.

all41
Level 15
Level 15
Posts: 5698
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Post by all41 » Tue Oct 24, 2017 1:53 am

hey catweasel how can you tell if it works?
please don't plonk me

Post Reply

Return to “Tutorials”