0

I would like to block certain websites to improve productivity and avoid distraction. I have found BlockSite (Brave browser extension) to be a very good tool but it has one fatal flaw in that it can be disabled very easily via the taskbar at the top. I would like a more sturdy solution.

I initially used the method outlined here but I found that this method did not emulate the functionality of BlockSite, the latter of which would block every page on Facebook or Twitter (for example), this method of editing the /etc/hosts file only ended up blocking twitter.com and not all pages associated with Twitter (I could still access, for example, Joe Biden's or Donald Trump's Twitter pages)

What is the best way to completely block certain websites on ubuntu in a way that makes it difficult to unblock them?

0

I think this is the fastest to implement solution:

https://linoxide.com/tools/chomper-command-line-tool-block-website-linux/

You could also use something like CTparental if you prefer something with a GUI:

https://linoxide.com/linux-how-to/ctparental-parental-control-tool-linux/

this guide is a bit outdated, you will need to download the current version from here instead of github:

https://gitlab.com/marsat/CTparental/-/releases

-1

You were on the right track with /etc/hosts, dealing directly with hostname resolution. The issue, as you point out, is that you can't wildcard all the subdomains there. For that, you'll need to set up a DNS server (how to do so is beyond the scope of this answer)

6
  • Thanks for the answer. Are you aware of any third-party applications (something along the lines of parental control maybe) that can be installed on Ubuntu to add site blocking functionality? – user440418 Nov 4 '20 at 12:32
  • 1
    Since the OP already knows about /etc/hosts and requires it to work for subdomains (" I found that this method did not emulate the functionality of BlockSite") explaining how to use /etc/hosts to block subdomains is the only possible scope for the answer. As it stands, your answer isn't adding anything the OP doesn't already know. – terdon Nov 4 '20 at 12:32
  • @terdon Thank you for your comment. Are you familiar with how to use /etc/hosts to block all subdomains? I have tried wildcarding using "" e.g. "www.twitter.com/" but this does not work. – user440418 Nov 4 '20 at 12:36
  • @user440418 no, sorry, I don't know about this sort of thing at all. I was just pointing out that Fox's answer was not really answering your question since the parts that could actually help you were considered out of scope. – terdon Nov 4 '20 at 12:49
  • @user440418 as I mentioned in this answer, you cannot wildcard in /etc/hosts. you have to either list every possible subdomain, or use a proper DNS server – Fox Nov 4 '20 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.