LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 04-13-2010, 07:45 AM   #1
rob33n
Member
 
Registered: May 2007
Location: Turkey
Distribution: Debian
Posts: 134

Rep: Reputation: 16
Give access to website in /etc/host


I want to give some web address to host file and except these web address no website will open.
For example I give permission for www.google.com and www.linuxquestions.com. The user just enter these 2 website. Other websites will be blocked.
How can I do this? Or is there any program for this?
 
Old 04-13-2010, 08:40 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
You can't do it in /etc/hosts unless you add a line for every site you want to block
Code:
127.0.0.1           www.website.com
127.0.0.1           www.website2.com
127.0.0.1           www.website3.com
Look at squid proxy instead.
 
Old 04-13-2010, 09:16 AM   #3
rob33n
Member
 
Registered: May 2007
Location: Turkey
Distribution: Debian
Posts: 134

Original Poster
Rep: Reputation: 16
But I don't want to block all websites. I just have give access max 10-15 websites. These websites can accessible. Other will be blocked.
 
Old 04-13-2010, 09:30 AM   #4
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
You may want to look at iptables. This is the actual filter that blocks or allows a website and you can write rules for it that allows certain websites to connect while blocking others. However, it's not recommended for novices! I'm not sure it could handle external whitelists (a file specifically naming allowed websites) though...
 
Old 04-13-2010, 09:47 AM   #5
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
Quote:
Originally Posted by rob33n View Post
But I don't want to block all websites. I just have give access max 10-15 websites. These websites can accessible. Other will be blocked.
What did I say ?
You can't allow access with /ect/hosts you can only block.
Which means blocking every web site except the ones you want to keep. So you do want to block all web sites, EXCEPT the ones you want to keep.

Last edited by smoker; 04-13-2010 at 09:49 AM.
 
Old 04-14-2010, 03:00 AM   #6
rob33n
Member
 
Registered: May 2007
Location: Turkey
Distribution: Debian
Posts: 134

Original Poster
Rep: Reputation: 16
Yes I know I can't do this in /etc/host. I just want some advice.
Can I do this with Dansguard? Or is it necessary?
 
Old 04-14-2010, 03:23 PM   #7
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 544Reputation: 544Reputation: 544Reputation: 544Reputation: 544Reputation: 544
Merhaba,

If you are interested in blocking access to various web sites, then consider using a second hosts file with dnsmasq. That is what I use to block many sites. This is a simple and straightforward black list approach. You can start with a healthy block list here. Save that file as /etc/hosts-adservers. Then configure dnsmasq to use that second hosts file. There is no content filtering with this solution --- just plain and simple IP address blocking.

If you are interested in restricting access only to specific web sites --- a white list approach, then you'll have to use some kind of filtering through iptables, squid, dansgaurdian, or something similar. If you use dansguardian you do not have to use squid. You can use something like TinyProxy. Dansguardinan only needs a transparent proxy and that does not always mean the complicated squid.

Using dnsmasq or a transparent proxy does not require any configuration changes to your web browser.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
convert LAN IP address to Host Name when I give cmd tail -f /var/log/squid/access.log rs15 Linux - Networking 6 01-22-2012 02:45 AM
How to give IP and host name asifbasha Linux - Networking 2 12-06-2009 12:19 AM
Please give me input on my fledgling website :) Mohtek General 10 03-13-2007 02:51 PM
set up access to host a website per user bjs Linux - Newbie 1 01-10-2006 12:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 03:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration