0

Has anyone used this method: http://www.putorius.net/2012/01/block-unwanted-advertisements-on.html

I tried per instructions. Maybe I'm too new to Linux, it's not working for me.

While looking for etc/hosts I came across hosts.allow and hosts.deny. Do I simply add doamains to the hosts.deny list ?

1 Answers1

4

The main problem there is that it assumes the user is root. I modified the script to add in sudo, so that any user allowed to use sudo can use the script.

#!/bin/bash
cp /etc/hosts ~/.etchosts
cd /tmp
wget http://winhelp2002.mvps.org/hosts.txt
sudo rm /etc/hosts
sudo mv hosts.txt /etc/hosts
cat ~/.etchosts | sudo tee -a /etc/hosts

That being said, I recommend you use an extension in whichever browser(s) you use to block ads there instead of messing with /etc/hosts. I find the extensions do a better job of blocking ads while allowing content.

saiarcot895
  • 10,917