Free low-level website restriction in Windows and Linux

Free low-level website restriction in Windows and Linux

You've probably tried your hand at a couple of DNS services to restrict access to certain websites on your machine, and maybe even some paid software. However, you may have discovered that these services don't cater to every browser out there. Some browsers manage to find a way to bypass these services, which can be quite strange and frustrating.

Interestingly, iOS users are free from this hassle as Apple maintains a very low-level access control that truly helps to implement restrictions regardless of the browser being used.

In this blog post, I would be giving directions on how to set up system-level access control in Windows and Linux operating systems, I would not be boring you with the low-level technicalities involved in this but the ground rule to this is that everything that can be done in an operating system is determined by a file or files, meaning everything is a file.

Windows

What you are doing here is modifying the host file and instructing it on sites that should be forbidden OS-wide.

To do this, run your notepad as an administrator, and do Ctrl + O to open a file, you would be prompted to select a file to edit, navigate to this path C:\Windows\System32\drivers\etc\hosts, and simply edit the file.
What you do here is pretty simple, at the end of the file, add the following lines to block the intended websites:

127.0.0.1 firstwebsite.com
127.0.0.1 secondwebsite.com
127.0.0.1 continuewebsite.com

replace the sample websites with the websites you intend to block, save the file, and close your notepad and you are good until you remove the website from that list, you can restrict as many websites as possible, I currently restrict about 15k websites on each of my operating systems.

Linux

Just like in Windows, you are modifying the host file to instruct your OS to restrict access to specified websites.

this process is specific to Debian and Debian-based operating systems, you can try it for other operating systems.

To do this, you have to edit the host file as a super user.

Simply open terminal, and type:
sudo nano /etc/hosts, if prompted provide your password, and at the end of the file paste a list of the sites you wish to restrict access as given below, save and exit.

127.0.0.1 firstwebsite.com
127.0.0.1 secondwebsite.com
127.0.0.1 continuewebsite.com

and you are good.

Ps: If you are looking to restrict access to explicit sites on your machine, I made a collection of about 15k sites, all you need to do is copy and paste here.

cover image credit https://www.pexels.com/@jill-burrow/