You are not logged in.
/etc/hosts can be used to block unwanted sites system-wide, see https://en.wikipedia.org/wiki/Hosts_(file)
Configuration of this file can be tedious and time-consuming:
http://www.makeuseof.com/tag/modify-man … ile-linux/
Fortunately, there is a quick and dirty more efficient method available.![]()
Try this:
git clone http://git.r-36.net/hosts-gen && cd hosts-gen
sudo make install
sudo cp examples/gethostszero /bin
sudo chmod 775 /bin/gethostszero
sudo /bin/gethostszero
sudo hosts-genThis will populate /etc/hosts with a list of the most egregious web abusing sites and will block them automatically.
To update the list, use:
sudo gethostszero
sudo hosts-genWith thanks to Christopher Lohmann for this solution.
To update the file automatically, a systemd timer could be used.
https://wiki.archlinux.org/index.php/Systemd/Timers
Create two files:
/etc/systemd/system/hostszero.timer
[Unit]
Description=Update /etc/hosts daily.
[Timer]
OnCalendar=daily
AccuracySec=1h
Persistent=true
[Install]
WantedBy=timers.target/etc/systemd/system/hostszero.service
[Unit]
Description=Update /etc/hosts
[Service]
Type=oneshot
ExecStart=/bin/gethostszero
ExecStart=/bin/hosts-genThen enable this with:
sudo systemctl enable hostszero.timerDisable it with:
sudo systemctl disable hostszero.timerCheck the status with:
systemctl status hostszero.timerWhich should look something like this:
empty@TheLab:~$ systemctl status hostszero.timer
● hostszero.timer - Update /etc/hosts daily.
Loaded: loaded (/etc/systemd/system/hostszero.timer; enabled)
Active: active (waiting) since Sun 2016-07-24 18:00:27 BST; 2min 42s ago
empty@TheLab:~$The original /etc/hosts file is available here:
http://someonewhocares.org/hosts/zero/hosts
Offline
I've been using someonewhocares manually for several months now, and the highest praise I can give it is I don't even notice it's working.
Between it and my browser extension uBlock Origin (which, by the way can utilise the same ruleset AND keep it up to date) I rarely see an advertisement for anything.
Thankyou HOAS, this looks useful.
Red
Knowledge Ferret
Offline
I use exclusively /etc/hosts for my browser.
This github is really good source precisely for blocking malicious via hosts.
Usually i update whenever there are new.
Of course not perform strongly like uBlock, Nevertheless prevents unnecessary dirt links.
Thanks HoaS for opening this thread.
8810
Offline
on archlinux, this one has been gaining popularity & credibility over the past couple of years or so, as long as i've been using it without problems.
Offline
Would this work on a Jessie/Bunsen setup as well? I'm struggling a bit, I just did the following today #! Waldorf -> Wheezy -> Jessie with Bunsen on the source list.
Offline
Would this work on a Jessie/Bunsen setup as well? I'm struggling a bit, I just did the following today #! Waldorf -> Wheezy -> Jessie with Bunsen on the source list.
Good luck with that - I hope you did everything needed to stop breakage due to the Crunchbang packages.
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
Would this work on a Jessie/Bunsen setup as well?
referring to my previously mentioned hostsblock? yes, definitely.
I'm struggling a bit, I just did the following today #! Waldorf -> Wheezy -> Jessie with Bunsen on the source list.
i think damo commented on this bit.
if it worked, lucky you!
Offline
Would this work on a Jessie/Bunsen setup as well?
The method should be universal and only requires that systemd is run as PID1 (init).
Offline
Thank you,
Works perfectly here, though I had this whenever I sudo:
sudo: unable to resolve host Bunsenlabs-mutantNeeded to add the following line to /etc/hosts:
127.0.1.1 Bunsenlabs-mutantI suppose this will be overwritten on the next hosts update though...
Last edited by matmutant (2016-08-27 18:45:06)
Offline
I suppose this will be overwritten on the next hosts update though...
this is taken care of with the hostsblock script that i previously mentioned!
Offline
I suppose this will be overwritten on the next hosts update though...
No, this method uses /etc/hosts.d/ to ensure that any changes to /etc/hosts are maintained, AFAIUI.
Offline
Of course not perform strongly like uBlock, Nevertheless prevents unnecessary dirt links.
i think all 3 methods in this thread work the same:
combining hosts blocklist files floating on the web, into one that resides on your system as /etc/hosts, providing application-independent (!) host blocking.
in my experience this method blocks ads 100% as efficiently as a browser addon like ublock origin or adblock+ - the only difference is that these browser addons are better at collapsing empty elements.
in all cases - hosts or browser addon - it comes down to a good blocklist.
Last edited by ohnonot (2016-08-28 06:38:03)
Offline
matmutant wrote:I suppose this will be overwritten on the next hosts update though...
this is taken care of with the hostsblock script that i previously mentioned!
Ok, thank you, I didn't read the script well enough to see this O:)
That is perfect then!
Offline