/etc/hosts and Snow Leopard

mcs37

macrumors regular
Original poster
Mar 2, 2003
185
1
Washington, DC
Back on Leopard I used /etc/hosts happily like any other *nix box in the last decade, but now on Snow Leopard when I modify it to push a few changes to existing machines, the updated entries don't seem to stick. It seems when I reboot they restore to their old settings so now I have to modify /etc/hosts every time I reboot.

I'm sure I'm doing something wrong, I just have no idea what that would be -- someone please advise.
 

jbuk

macrumors regular
Jun 8, 2009
124
0
I'm going out on a whim here, but try giving your account full control of /etc/hosts and the system read-only privileges?
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,857
7
USA
I haven't had any issues like that. I modified mine to point to my virtual hosts web sites. How are you editing the file? I generally just sudo the file into pico and edit it in Terminal.
 

mcs37

macrumors regular
Original poster
Mar 2, 2003
185
1
Washington, DC
Here we are a few weeks later and this problem is still here on Snow Leopard. Every time I reboot the damn machine I have to modify /etc/hosts again to set the local network fixed IPs. I'm a little curious why I'm the only person with this...
 

Azrel

macrumors regular
Jun 8, 2005
117
0
Are you sure you're writing to the file correctly? I've not used emacs, but here's my routine:

$sudo nano -w /etc/hosts
$dscacheutil -flushcache
 

Mumford

macrumors regular
Oct 8, 2006
181
2
Altadena, CA
Here we are a few weeks later and this problem is still here on Snow Leopard. Every time I reboot the damn machine I have to modify /etc/hosts again to set the local network fixed IPs. I'm a little curious why I'm the only person with this...
Just tested on mine... edited /etc/hosts, then rebooted. My changes persisted.
 

torana355

macrumors 68040
Dec 8, 2009
3,497
2,493
Sydney, Australia
Mines works fine in SL and worked fine in leopard too. I copy the file to the desktop, open the file in a text editor do my changes then save it. Then i copy it into the etc folder.
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,857
7
USA
Here we are a few weeks later and this problem is still here on Snow Leopard. Every time I reboot the damn machine I have to modify /etc/hosts again to set the local network fixed IPs. I'm a little curious why I'm the only person with this...
Just a troubleshooting idea: Make the edit as usual, and make note of the modified time for the file from Finder (or Terminal). Then go and reboot and check the modified time to see if it was modified during the reboot at some point.

As a lame temp solution, you can store a correct hosts file and have it copied into place at login by having the action stored as a launch item. I did this for a Leopard bug for a similar problem.
 

galan05

macrumors newbie
Mar 19, 2010
1
0
Need help with this, also

I've never worked one second in Linux, but I have to edit my hosts file in Snow Leopard to point my blog to a new IP address. I can't even FIND the hosts file in Snow Leopard. This is the total directions I was given by the techs at GoDaddy:

"Host files are text documents that you can edit with any text editor. Add the Server IP Address and your domain name to your host file on an individual line. Follow the format of any previous entries for the order of the IP address and domain name.


Host file paths for popular operating systems:



Linux: /etc/hosts

Macintosh OS X: /etc/hosts"

If you're familiar with Linux, that may be all you need. I'm not, so I'm totally lost. Can anyone help?

.greg
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,857
7
USA
@galan05, the hosts file is in a hidden folder by default, which is likely why you are having problems finding it. Grab TextWrangler, and it will give you an option under the File menu to open hidden files, then you can go to the etc folder at the root level and find the hosts file inside it. Just be careful with the file, you can mess things ups editing it incorrectly. You'll need admin privileges to edit this file as well.
 

joecool99

Suspended
Aug 20, 2008
726
69
USA
Experiencing the same problem. Both /etc/hosts and /private/etc/hosts gets replaced during the boot to original state.
 

Similar threads

Replies
5
Views
2K
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.