4

I want to block all, but one or two websites. This question is therefore relatively close to, but different from the following

I know that this can be done with leechblock (for FF) or something similar for other browsers. I think that is not a very clean solution, because it is browser-based. I know this was both possible and easy with Firestarter but that package is deprecated.

I am looking for something which is both easy (not manually editing hosts, but a script for instance) and systemwide. It can use the CLI.

I would love a relatively detailed answer rather than just links to other websites - screenshots would be most welcome.

don.joey
  • 28,662
  • 1
    Why is this different from your other question? Stick a bounty on it if you want it answered rather than just asking it again and again. – Oli Aug 08 '13 at 09:36
  • Oli, check the chat. I talked it over with fossfreedom. Also there is no reference question for this problem. – don.joey Aug 08 '13 at 09:41
  • Should I conclude that this is not possible without modifying hosts? – don.joey Aug 12 '13 at 15:12
  • 1
    No, the very first option I gave you in your other question (the port of Self Control) does this with iptables. – Oli Aug 12 '13 at 15:22
  • I think it is a mistake to think of this as a duplicate. After all, the suggested dupe question is about restricting access to certain websites, whereas this question is from the other perspective: restricting everything except one or two. The solution proposed by Oli does not, and I repeat, not do that. It only blacklists, but does not whitelist. – don.joey Aug 20 '13 at 19:28
  • I can't tell the difference between this question and your other one. Maybe think harder about what makes them different, then edit both to make them clearly distinct. Maybe you just need to delete both and write a single better question. – djeikyb Aug 20 '13 at 22:56
  • Please read my previous comment. – don.joey Aug 21 '13 at 06:16

1 Answers1

0

You can block websites system-wide by adding entry to hosts file. It works same as in windows.

Here's how to do it :

Open terminal and type :

sudo nano /etc/hosts

append the file with

127.0.0.1 facebook.com

Now whenever you'll visit facebook.com it will take you to localhost. FYI, it is not re-direct.

Worth reading: http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/

johnny
  • 17
  • 1
  • For reference' sake, I was asking for something "easy (not manually editing hosts, but a script for instance)." – don.joey Aug 08 '13 at 10:09
  • 1
    This really does not answer my question as I ask for all websites to be blocked, except a few. – don.joey Aug 09 '13 at 14:40