Author Topic: How to block access to certain Web Sites from your computer.  (Read 380 times)

0 Members and 1 Guest are viewing this topic.

Offline fiRepath

  • UNIX is very simple, it just needs a genius to understand its simplicity. -- Dennis Ritchie
  • Moderator
  • Chatters
  • Posts: 19
  • Gender: Male
  • Hannibal ante portas
There are many commercial applications that enable you to block access to certain Web sites from your computer.
In this tutorial you will see how to do it in a very simple way, without installing any additional software.
Locate the file hosts in the directory /etc on linux:
We are about to edit the /etc/hosts file.
Note:(for Windows users: C: \WINDOWS\system32\drivers\etc\hosts ).
Run the following command (as root user) to edit the file:

Code: [Select]
$ sudo nano /etc/hosts
And bellow the line 127.0.0.1 localhost , enter:

Code: [Select]
127.0.0.2 www.facebook.com
Save the file (CTRL + 0 and hit ENTER)
The Website will be no longer available.
Note: For each additional site you wish  to block just add the " 1" from the last number of IP. For example:

127.0.0.3 www.youtube.com
127.0.0.4 www.msn.com

Voila!
« Last Edit: March 06, 2012, 05:46:57 PM by fiRepath »


The best way to learn UNIX is to play with it, and the harder you play, the more you learn.

Chanops Community