Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Block Site Using HOSTS File

Block Site Using HOSTS File
Thread Tools
Mac Elite
Join Date: Aug 2002
Location: Kyoto, Japan
Status: Offline
Reply With Quote
Nov 25, 2003, 04:57 PM
 
I know how to use the HOSTS file in Windows, but am not sure how to go about using it in Mac OS X to block access to a website.

If it can not be done, is there another way to block access to a specific website?
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Nov 25, 2003, 05:30 PM
 
Seeing as the hosts file in Windows was picked up from BSD (as far as I can tell) you should have no problem using it with OS X. You may need to change some settings to make sure the system checks the file though, I remember in 10.1 I had to set something in netinfo.
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Nov 26, 2003, 10:02 AM
 
Why not use ipfw?

Mr. Hammer, meet Mr. Nail.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
Mac Elite
Join Date: Nov 2001
Status: Offline
Reply With Quote
Nov 26, 2003, 10:32 AM
 
Originally posted by Kristoff:
Why not use ipfw?

Mr. Hammer, meet Mr. Nail.
Using the firewall to block a specific site? Methinks you have a hammer and think everything LOOKS like a nail ;-)

Anyway you can use the hosts file (it's located in /etc/hosts) to do this... just have an entry like this:

127.0.0.1 foo.com bar.foo.com

where the latter entry is the domain name of the site you want to block. Lookups for that site won't use DNS, so it won't properly resolve.

An alternative of course is to use a proxy server to do a real job of blocking the sites. That's more advanced, but more flexible too.
     
Mac Elite
Join Date: Sep 2000
Location: various
Status: Offline
Reply With Quote
Nov 27, 2003, 05:46 PM
 
hi.

there are actually a good group of articles over here that detail specificly how to use host files in osx. the main one is listed as under review, which i assume means re-done for panther. hopefully it will be back online soon.

this is one of the first hacks i missed when i installed panther. always forget how many ads there are on the net.

if anyone else knows other sites detailing how to do this (it's pretty intimidating if you're non-unix aware initially) please toss up a link.

poocat.
"The supreme irony of life is that hardly anyone gets out of it alive."
-Robert A. Heinlein, Job
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:49 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2