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 10
Level 10
Posts: 3316
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

Postby 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.
If your problem is fixed, please mark your thread as [SOLVED] by editing the title of the first message in the thread.

sammiev
Level 4
Level 4
Posts: 229
Joined: Sat May 19, 2012 12:16 pm

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

Postby sammiev » Sat Oct 21, 2017 10:40 pm

Thanks testing it now.
Image

Resistor
Level 3
Level 3
Posts: 137
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

Postby 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?
LM 17.3 Qiana v2, Cinnamon. Windows 8 is gone.
Dell Inspiron 15z 5523, 6 GB RAM, Intel i3-3217U, Intel Centrino Wireless-N 2230. 32GB SSD PM830. Intel 7 Series/C210 Audio. snd_hda_intel bus-ID: 00:1b.0... ALSA v: k3.16.0-37-generic

User avatar
catweazel
Level 10
Level 10
Posts: 3316
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

Postby catweazel » Mon Oct 23, 2017 12:57 am

Resistor wrote:Do we need to do anything with the other Host files?

No.
If your problem is fixed, please mark your thread as [SOLVED] by editing the title of the first message in the thread.

User avatar
Pierre
Level 15
Level 15
Posts: 5853
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

Postby 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 3
Level 3
Posts: 137
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

Postby Resistor » Mon Oct 23, 2017 1:03 am

I appreciate the insight, catweazel.
I know more now, than I did on Saturday... :mrgreen:
LM 17.3 Qiana v2, Cinnamon. Windows 8 is gone.
Dell Inspiron 15z 5523, 6 GB RAM, Intel i3-3217U, Intel Centrino Wireless-N 2230. 32GB SSD PM830. Intel 7 Series/C210 Audio. snd_hda_intel bus-ID: 00:1b.0... ALSA v: k3.16.0-37-generic

Resistor
Level 3
Level 3
Posts: 137
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

Postby 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...
LM 17.3 Qiana v2, Cinnamon. Windows 8 is gone.
Dell Inspiron 15z 5523, 6 GB RAM, Intel i3-3217U, Intel Centrino Wireless-N 2230. 32GB SSD PM830. Intel 7 Series/C210 Audio. snd_hda_intel bus-ID: 00:1b.0... ALSA v: k3.16.0-37-generic

Aleron Ives
Level 3
Level 3
Posts: 122
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

Postby 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 10
Level 10
Posts: 3316
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

Postby 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.
If your problem is fixed, please mark your thread as [SOLVED] by editing the title of the first message in the thread.

Aleron Ives
Level 3
Level 3
Posts: 122
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

Postby 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 10
Level 10
Posts: 3316
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

Postby catweazel » Mon Oct 23, 2017 5:14 am

Aleron Ives wrote:Using your hosts file for this purpose seems rather inelegant. :wink:

<shrug>
If your problem is fixed, please mark your thread as [SOLVED] by editing the title of the first message in the thread.

User avatar
Moem
Level 11
Level 11
Posts: 3676
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

Postby 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: 122
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

Postby 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 11
Level 11
Posts: 3676
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

Postby 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 13
Level 13
Posts: 4543
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

Postby 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.
Mint 18.2 Xfce/fluxbox/pulse-less - Xubuntu 16.10/fluxbox/pulse-less
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

Postby 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 4
Level 4
Posts: 375
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

Postby majpooper » Mon Oct 23, 2017 9:16 pm

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

sammiev
Level 4
Level 4
Posts: 229
Joined: Sat May 19, 2012 12:16 pm

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

Postby 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
Image

User avatar
catweazel
Level 10
Level 10
Posts: 3316
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

Postby 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.
If your problem is fixed, please mark your thread as [SOLVED] by editing the title of the first message in the thread.

User avatar
all41
Level 11
Level 11
Posts: 3517
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

Postby all41 » Tue Oct 24, 2017 1:53 am

hey catweasel how can you tell if it works?
please don't plonk me
Proud to be a supporter and monthly contributor to Mint.


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 6 guests