Monday, February 20, 2012

How to block a website in ubuntu?

In order to block a website,you need to have knowledge about nscd which stands for Name Service Cache Daemon.The nscd is a daemon which handles passwd, group and host lookups for running programs and caches the results for the next query. You should install this package only if you use slow Services like LDAP, NIS or NIS+.In case if you are maintaining an institution,you should be in the position to block websites that are adult related.


Open terminal using Applications ---> Accessories ---> Terminal (or) Press Ctrl + Alt + t.

Step 1 : Type the following :

     sudo gedit /etc/hosts



step 2 : Now add the following line to the file and click on Save.

    127.0.0.1       domaintoblock.com



Step 3 : Flush DNS cache using the nscd if the domain name is still not blocked.

     sudo apt-get install nscd
   

Step 4 : Restart Name Service Cache Domain.

     sudo /etc/init.d/nscd restart



Step 5 : Surf for the website you have blocked in the web browser.

Blocked right!

1 comment:

  1. why is that when i type sudo gedit /etc/hosts and enter it, the following line is asking me for the password...when i am typing the password, it won't write... but when i type gedit /etc/hosts and enter it, it proceeds to the gedit app, but it is read-only...i cannot type any letter or number..what is the problem????

    ReplyDelete