tl;dr what are all the ways I can block a website on linux? Debian if it’s relevant.
I want to stop myself using certain sites. Since I’m reasonably techy and can work round all blocks I’ve come up with, I’ve found an effective approach is to apply as many hurdles as possible, so that visiting the website takes effort.
So far I’ve added the site to ublock’s block list, and redirected sites via /etc/hosts. What other options are there?
While I have admin access to the router, I’m not allowed to block sites there.
use the redirector addon to auto redirect somewhere else
You could try behavioral therapy. Doesn’t need to be psychiatrist (but does have to be professional).
Therapy of some sorts is probably going to be more effective than making self-blocks, especially if you’re technically competent. I wish you luck with stopping whatever addiction it is.
The real hack is (almost) always social.
It can help. A lot of the time I go on Reddit for example starts subconscious. If that doesn’t work the conscious part kicks in and I know I don’t want to visit that craphole so I close the tab again and put the phone aside. Otherwise I see content and keep scrolling.
Setup a PiHole and add them to the blocklist. Then make the PiHole password stupid long and write it down. Then take the paper, put it in a safe, and put it in the highest shelf in the back of your closet. Recurse safes and passwords as much as needed.
Even better, store the password offsite—safe at a friend’s house, safety deposit box at the bank . . .
well I do hate going into town, so that would work
And if you don’t have any friends or a bank, put it in a double ziplock, then drop it in a Tupperware of water and freeze it.
You’re gonna have better luck changing your habits than you will making a block that you yourself can’t overcome.
Creating hurdles can help lowering the temptation. I totally get OP.
Therapy is probably a better option.
Only thing I can think of is to remove your default account from the sudoers file and have an account with a frustratingly long password written on physical paper hold the keys to the kingdom. That will make a whole lot of other things a hurdle too though.
Yeah, whatever roadblocks are set up can easily be dismantled using the same privs.
Only way to achieve this goal is to either hand the keys to someone else or to lock yourself out.
Making it a hassle to circumvent the roadblocks can help make the undesired behavior less attractive to you in the moment or stop unconscious behavior.
For example, I sometimes open lemmy just with my muscle memory when I’m bored without even thinking about it, even though I know I’ve scrolled through pretty much all the current content I get in my feed already.
Moving the app icon around stops me from opening lemmy without actively thinking about it and therefore adds a (admittedly small) barrier to my bad behavior.
Adding a long and complex password that I would have to enter manually, as someone in the comments recommend, would probably make me rethink my actions even more. Do I really want to get out the password and be annoyed by having to type it out just to do this?
/etc/hosts and set the websites to go to 0.0.0.0 or 127.0.0.1
Roughly from high level to low level:
- uBlock custom filters
- Make pages unusable or less attractive by wonky per-site browser or extension settings
- IP and DNS blocks on your local machine
- Run a DNS proxy on your local machine and block domains with it
- Host a pihole server on a different machine, make it your DNS server and block domains there
- IP and DNS blocks in your router (if your current one has no option for this, consider buying another, preferably used)
Best apply the methods arbitrarily, so that you get even more confused about how you might restore access to a given website.
Options 5 and 6 may be the only viable ones for locking down certain smartphones or tablets.
DNS… set your system up to use an external DNS provider like OpenDNS where you can select categories to block.
I used this to block adult, gambling, malware, etc at the grandparent’s house when the kids were growing up and starting to search the internet for school homework, etc.
If it’s done in the router you’ll cover all devices and you give someone else the password, so you can’t change it.
Don’t look for a solution that is technical where the problem is mental.
lmao. I hate takes like this.
It’s not about making the website impossible to get to, it’s about making the website more difficult and annoying to get to than an alternative productive activity/site.
Part of making it difficult to get to is technical.
It’s not a solution to a problem, it’s a mitigation option. There is a lot of evidence that it works. Even OP mentioned that it’s effective for them.
Any of the adblockers can do this. Pihole, adguard home, technitium. Ublock origin to. You can probably do it pretty painstakingly through the hosts file as well.
LeechBlock NG isn’t exactly what your’e looking for but it still may help. Of course, it’ll have no effect if UBO and the DNS already shut everything off.
If redirecting with /etc/hosts isn’t enough, you could set up a cron job (I guess as root?) to re-copy a hosts file back to /etc/hosts every half hour or something. That way even if you do manually change /etc/hosts for an quick peak of an illicit website, it’ll go back to being blocked in a short amount of time. This’ll add a bit of the “pain in the ass” factor.





