Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mhaddy

macrumors 6502
Original poster
Oct 26, 2005
445
1
Canada
Hi guys,

I'm the proud owner of a new 2.0DC PowerMac and I absolutely love it! I run a web server that hosts several websites to which my PowerMac is connected via an internal LAN. Each website that I host has its own domain name, so on my old windows machine, I'd have to edit my .hosts file and add entries like:

192.168.1.103 maddogstudios.net

...to bind the maddogstudios.net domain to my local (internal) LAN IP of the server hosting it (I hope that's not confusing!).

Anyhow, I was wondering what Tiger's equivalent to this Windows .hosts file is. Hope to hear from you soon, thanks!
 

freiheit

macrumors 6502a
Jul 20, 2004
643
90
California
Hosts file

The Tiger equivalent is, not surprisingly, the hosts file. Yep, it's an old UNIX thing that's come along down to OS/2 and Windows, etc. You'll find it in the top level /etc directory I believe.
 

Mhaddy

macrumors 6502
Original poster
Oct 26, 2005
445
1
Canada
Thanks for the quick response, guys. Oddly enough, soon after I posted the thread, I found out about the /etc/hosts file, heh. I was in Terminal and typed "pico hosts" (once inside the /etc/ dir). When I tried to save the file though, it gave me a permission denied error. I know I'm an admin on this PC (I'm the only user on it!)... so is there a program that I have to exit or a certain way of opening the file that will allow me to edit it?

Thanks!

Edit: I figured it out :). Thanks again guys.
 

PCheese

macrumors member
Aug 9, 2004
50
0
When you do figure out the answer, it's good to post it in case other people come across the same thread with the same question.

The answer is to use sudo:
Code:
sudo pico /etc/hosts
 

Mhaddy

macrumors 6502
Original poster
Oct 26, 2005
445
1
Canada
That actually didn't work for me -- it gave me a permission denied error. What I did was:

- Open up Terminal
- Type: sudo nano /etc/hosts
- (enter your password)
- do your edits
- Type: lookupd -flushcache

Jeff Hubbach from the Apple support forums helped me out with this.
 

JDar

macrumors 6502a
Dec 7, 2003
529
2
There is a shareware program called "Hostal" that you can find on VersionTracker that allows easy additions and deletions to your Hosts file. It's by Northern Software http://www.northernsoftworks.com/ which does some neat small programs. I've had Hostal going for years and don't know of any problem it has ever caused.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.