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.

  • dieTasse@feddit.org
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    1
    ·
    7 hours ago

    You could try behavioral therapy. Doesn’t need to be psychiatrist (but does have to be professional).

  • redrum@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    9 hours ago

    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
    
    • redrum@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      9 hours ago

      Also, to block them in the firefox browser, you can also use the FoxyProxy extension, 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:

  • Mensh123@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    16 hours ago

    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.

    • placebo@lemmy.zip
      link
      fedilink
      English
      arrow-up
      2
      ·
      18 hours ago

      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.

  • barlog@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    18 hours ago

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

  • FoundFootFootage78@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    21 hours ago

    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.

  • communism@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    1 day ago

    Maybe block on your router and save your router password such that you need to jump through several hoops to unlock it, eg password saved in one password manager DB whose master password is in another DB whose password is in another DB, etc. If you have to unlock like 10 password databases to get into your router, you’ll probably give up on whatever bad habit you were trying to do as it’s too much effort.

  • kungen@feddit.nu
    link
    fedilink
    arrow-up
    33
    arrow-down
    3
    ·
    2 days ago

    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
      4
      ·
      1 day ago

      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.

  • jdnewmil@lemmy.ca
    link
    fedilink
    arrow-up
    2
    arrow-down
    3
    ·
    22 hours ago

    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.

  • BartyDeCanter@piefed.social
    link
    fedilink
    English
    arrow-up
    20
    ·
    2 days ago

    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.