LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-09-2008, 12:31 PM   #1
sirius57
Member
 
Registered: Jun 2004
Distribution: puppy linux, suse 10.0, opensuse 11.3, 12.1, mythdora, opensuse 13.1, opensuse tumbleweed
Posts: 602

Rep: Reputation: 36
does suse 10.0 use a hosts file to block unwanted web sites like windows?


I want to add a hosts file in my suse 10.0 box. I installed a hosts file in winxp to block bad internet sites and want to do the same on my linux box. Also using firefox browser.
 
Old 09-09-2008, 12:51 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,681

Rep: Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971
Quote:
Originally Posted by sirius57 View Post
I want to add a hosts file in my suse 10.0 box. I installed a hosts file in winxp to block bad internet sites and want to do the same on my linux box. Also using firefox browser.
SuSE 10.0 is very old...11.0 is the latest. The 'hosts' file is normally used for name resolution, in the event you want to specify a different address for a host, other than the one it gets from DNS (or to keep from using DNS totally...).

If you want to block internet sites, squid and squid-guard can do it.
 
Old 09-09-2008, 01:49 PM   #3
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Yes, you can do that thing where you make bad domains resolve to 127.0.0.1. Of course, this isn't technically "blocking". Like TB0ne one said, you can use a proxy server to do real blocking.
 
Old 10-30-2008, 11:23 AM   #4
gymnart
Member
 
Registered: Oct 2005
Distribution: SUSE 11.4
Posts: 331

Rep: Reputation: 30
I use the hosts file to block some sites on my SuSE 10.0 box too.

The hosts file should be in the /etc folder and you have to be root to edit it. It works the same as the Windows one.
 
Old 10-30-2008, 03:20 PM   #5
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
ubuntu has hosts, hosts.deny, hosts.allow in the /etc directory.
 
Old 10-30-2008, 03:29 PM   #6
gymnart
Member
 
Registered: Oct 2005
Distribution: SUSE 11.4
Posts: 331

Rep: Reputation: 30
Hello john test.
SuSE 10.0 has that too. I've just used the plain "hosts" one the same way I use it in Windows.
 
Old 10-30-2008, 09:09 PM   #7
sirius57
Member
 
Registered: Jun 2004
Distribution: puppy linux, suse 10.0, opensuse 11.3, 12.1, mythdora, opensuse 13.1, opensuse tumbleweed
Posts: 602

Original Poster
Rep: Reputation: 36
Yes, I got it to work by appending the hosts file text to the hosts file. I leave the hosts.allow and hosts.deny alone. I found that the file does block pop ups.
 
Old 10-30-2008, 09:26 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You may cause problems if you cut and paste text from a windows text file. Make sure the line endings don't contain both newlines and returns.
They should just use newlines (\n).

You can check it by loading it into vim or running "od -a /etc/hosts". You should see a "nl" character between lines. You can fix a text file running "sudo dos2unix /etc/hosts".

Another thing you can do if you don't have very many IP addresses to block is to add iptables rules blocking ingress or outgress traffic from/to those addresses.
 
  


Reply



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
How do I block web pages/sites? Is squid what I should use? RHLinuxGUY Linux - Networking 3 02-06-2010 12:07 PM
Need help with blocking sites/editing Hosts file RodWC Linux - General 7 05-02-2007 02:17 PM
/etc/hosts doesn't always block sites General Linux - Security 16 01-23-2007 07:31 AM
I Can't use Linux Firefox or Opera to browse the web-sites I need to, under SUSE 10.0 DeekBeek Linux - Software 9 06-20-2006 04:12 PM
get Squidguard to block entire countries web sites? Possible? Pcghost Linux - Software 3 09-19-2004 02:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:36 PM.

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
Open Source Consulting | Domain Registration