Become a MacRumors Supporter for $25/year with no ads, private forums, and more!

Block access to a website

kerpow

macrumors 6502
Original poster
Jan 16, 2004
331
0
London
I wan to block access to a website on a Mac. In the Windows world the simplest way to do this is to open the Hosts file and add a fake DNS entry for the site eg.

10.0.0.1 http://www.website.com

Your average user will have no idea how to fix this.

Whats the simplest way to do this on a Mac without having to buy software?
 

4np

macrumors 6502a
Feb 23, 2005
970
2
The Netherlands
Whats the simplest way to do this on a Mac without having to buy software?

The same: by editting /etc/hosts....

A weird thing in a mac though is that the lookup order is different than on your average windows machine; if you want to use the hosts file to overrule a domain name you should also change the lookup order. You can do this by executing the following commands:

Specifying the lookup order in /etc/lookupd/hosts

% ls /etc/lookupd/hosts
ls: /etc/lookupd/hosts: No such file or directory
% mkdir -p /etc/lookupd
% sudo vi /etc/lookupd/hosts
insert LookupOrder Cache FF NI DNS DS and save
%
source: http://www.geektimes.com/macintosh/os/x/10_3/and/dns.html

and restart lookupd by executing a:

killall -HUP lookupd

If you don't want to edit your hosts file and the lookup order, you can use the netinfo manager (in applications/utilities).

If you want to do this company wide you could add an entry to your local DNS server (if you run one).
 
Comment

kerpow

macrumors 6502
Original poster
Jan 16, 2004
331
0
London
Figured it would be some file or other to edit. I'll give that a go.

Thanks
 
Comment

djdawson

macrumors member
Apr 28, 2005
59
0
Minnesota
The same: by editting /etc/hosts....

A weird thing in a mac though is that the lookup order is different than on your average windows machine; if you want to use the hosts file to overrule a domain name you should also change the lookup order. You can do this by executing the following commands:


source: http://www.geektimes.com/macintosh/os/x/10_3/and/dns.html

and restart lookupd by executing a:



If you don't want to edit your hosts file and the lookup order, you can use the netinfo manager (in applications/utilities).

If you want to do this company wide you could add an entry to your local DNS server (if you run one).

This is no longer needed in Tiger, and I don't think it was necessary in 10.3, either. I've never bothered with the lookup order and I put stuff in my /etc/hosts all the time. It just works.

HTH
 
Comment

bubbleboy450

macrumors newbie
Dec 8, 2007
9
0
Youtube Addict

I am sure that there are lots of other people trying to do the same thing. I don't want anyone on my computer to be able to access youtube, or facebook. I have tried editing my hosts file
sudo pico /ect/hosts (some recomend, sudo nano....)
i put in

127.0.0.1 youtube.com

Also have tried

127.0.0.1 http://www.youtube.com

and everyother combination of spaces, and tabs imaginable.

then hit crtl-o to save, and press y. All it says is "bus error" and doesn't save it. pressing crtl-x does the same thing. No mater what i do, it always says, "bus error".
Any ideas how i can get youtube baned from my computer for good? Making a second account is not an option.
P.s Using leopard. 10.5.1
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.