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.
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.
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.
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.
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.
Therapy is probably a better option.
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.
/etc/hosts and set the websites to go to 0.0.0.0 or 127.0.0.1
Private DNS service.
NextDNS is a good option for your use case. It allows you to block entire categories of websites and even has an option to setup a schedule on when you are allowed to access them. It also has blocklists you can pick from and the ability to blacklist and whitelist individual domains. And the free plan is very generous. You can just try it and see how it works for you.
deleted by creator
You can use iptables to block connections, by example, using
ufwthe uncomplicated firewall:# apt install ufw bind9-dnsutils # Install ufw and nslookup # uIPs=$((nslookup reddit.com && \ nslookup www.reddit.com && \ nslookup redd.it && \ nslookup redditstatic.com && \ nslookup www.redditstatic.com) \ | awk '/^Address: / { print $2 }' | sort -u); \ for uip in ${uIPs}; do \ echo -n "${uip} " && \ ufw deny from "${uip}" comment 'deny reddit.com'; \ ufw deny out to "${uip}" from any comment 'deny reddit.com'; \ done; # ufw enable # ufw status numberedAlso, to block them in the firefox browser, you can also use the
FoxyProxyextension, and use the proxy by patterns options to use a non-existant proxy for the domains that you want to block.Edit to add config example:

thanks for the great technical suggestions everyone
deleted by creator
See a psychiatrist. You already have root on these systems… if you are truly a split personality then fences aren’t going to prevent your other self from doing whatever they want.
i’m curious what websites are you doing. what’s the threat model??
lol it’s probably porn
reddit; may add news sites given the wonderful news we’re getting these days
oooh!! i did a *monkey (greasemonkey, violentmonkey (tampermonkey is not libre!)) script to redirect to a random xkcd page hashed based off of the url (despite xkcd not being a free cultural work)
i do not currently have it




