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.

  • BartyDeCanter@piefed.social
    link
    fedilink
    English
    arrow-up
    13
    ·
    9 天前

    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.

  • kungen@feddit.nu
    link
    fedilink
    arrow-up
    12
    arrow-down
    2
    ·
    9 天前

    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.

    • aksdb@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      8 天前

      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.

  • anamethatisnt@sopuli.xyz
    link
    fedilink
    arrow-up
    4
    ·
    9 天前

    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.

    • Peffse@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      9 天前

      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.

  • D_Air1@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    9 天前

    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.

  • Holytimes@sh.itjust.works
    link
    fedilink
    arrow-up
    2
    ·
    9 天前

    Just set the site to be hidden? If it’s not in the list you didn’t even know its an option and thus everything else is moot.

    Pretty sure every search engine at thing point has a option to just “not show results from this website” or equivalent.

    Out of sight out of mind.

  • Levi@lemmy.ca
    link
    fedilink
    English
    arrow-up
    2
    ·
    9 天前

    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.

  • FoundFootFootage78@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    8 天前

    DNS level blocking is a massive pain to circumvent. Adguard DNS and NextDNS allow you to do this. Mullvad DNS allows you to block adult websites, gambling sites, and (optionally) social media without creating an account.

  • redrum@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    8 天前

    You can use iptables to block connections, by example, using ufw the 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 numbered
    
  • barlog@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    8 天前

    I use NextDNS and it has feature to block domains. Unfortunately i often unblock it back.

      • Rain World: Slugcat Game@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        14 小时前

        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

  • SayCyberOnceMore@feddit.uk
    link
    fedilink
    English
    arrow-up
    1
    ·
    9 天前

    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.