4

I have installed a ubuntu 14.04 in my company, and I want to block websites in my browser Firefox/Chorme, but how can I do this?

Thanks!

Vitor Mazuco
  • 1,441

3 Answers3

20

You can add blocked websites to /etc/hosts and point them to localhost.

    127.0.0.1 firstblockedwebsite.com

    127.0.0.1 secondblockedwebsite.com

by this way ,blocked websites will show localhost, don't forget to check /etc/hosts permission.

teal33t
  • 977
3

Mozilla Firefox

Using Firefox you can use Block Site add-on to block any websites (blacklist) or allow only certain websites (whitelist). Here’s a screenshot from its preferences (sorry for my small display):

blocksite preferences

Google Chrome

And in Chrome/Chromium it seems there is an extension from the same developers.

Opera

Some time ago I was using Opera for its bits and whistles. There’s a built-in functionality to block contents there, under Preferences > Advanced > Content > Blocked Content.


I personally prefer the way @sparkmood mentioned here. It’s browser-independent. Brilliant!

AliNajafies
  • 5,874
1

You can use the "addblock plus" addon. together with "myscript", you can block selectively whatever you want easily.

Goksu
  • 299
  • How can I use this from addblock plus? – Vitor Mazuco Jul 03 '14 at 19:58
  • if using Firefox, go to https://addons.mozilla.org/en-US/firefox/ and check the popular addons on the right of the page. – Goksu Jul 03 '14 at 20:50
  • for Chrome, a google search for "addon adblock for chrome" will point you to the addon. :) – Goksu Jul 03 '14 at 20:53
  • 1
    This is not a good deal because this block can easily be bypassed by using a different browser. Better block the sites in /etc/hosts – annndrey Jul 03 '14 at 21:47
  • Whether it is a good deal or not depends on the intended use. I think the question is not very well formed. if he intends to prevent adds (add serving sites) an addblock addon will serve the purpose very well. it will update its list regularly and would also allow for custom blocks with a right click. editing the host file each time would be a hassle. – Goksu Jul 03 '14 at 21:59
  • however, if he meant that he set up a server for the intention of controlling access to the internet, thus use it as a content filtering system, again using specialized software (router/firewall/proxy) will be better from a management perspective. a host file edit would be practical for a limited set of sites. will he be the sole user? we are overguessing ourselves. – Goksu Jul 03 '14 at 22:00
  • 1
    @annndrey If I use /etc/hosts for block websites, can I use for block a some hours? Or not? – Vitor Mazuco Jul 04 '14 at 19:16
  • 1
    Sure, just create two files, /etc/hosts.allow and /etc/hosts.deny. The first will be an original hosts file with no blocks and the second should contain blocked sites records. After open your crontab (usually with sudo crontab -e) and paste there two lines: "0 9 * * * ln -f /etc/hosts.deny /etc/hosts" and " 0 22 * * * ln -f /etc/hosts.allow /etc/hosts". It will block any sites listed in hosts.deny from 9AM to 10PM. – annndrey Jul 04 '14 at 19:37