How to block certain website access in Linux without hardware firewall
If you want to block social media sites or certain list of sites in LINUX without any third party software or hardware firewall.It is possible in LINUX. You can do this via /etc/hosts file. For this you should have root access. Just follow the below steps to do it will take just few seconds.
Make sure /etc/hosts file is important one because it will handle all the DNS request, So before making changes you need to take backup.
|PC OS||UBUNTU 14.04 LTS|
|Root level Access||Yes|
For example, I’m going to disable facebook.com & youtube.com access from my PC.
Open the /etc/hosts file with your favorite text editor and add the below colored lines. If you want to block different website, add the corresponding website name instead of facebook.com or youtube.com. Save your text editor and exit.
[email protected]:~$ sudo nano /etc/hosts [sudo] password for magesh: GNU nano 2.2.6 File: /etc/hosts 127.0.0.1 localhost 127.0.1.1 magesh-desktop # block access to social media sites 127.0.0.1 www.youtube.com 127.0.0.1 www.facebook.com
Now, I’m going to check both website on browser whether its working or not.