MacOS – Changing permissions on /etc/hosts

hostsmacos

I frequently (at least once per day) need to edit my hosts file, and typing my password every time is getting annoying. I know how to change the permissions to allow myself to write to the file, and I'm aware of the security implications.

My question: will I break anything by modifying the ACLs on /etc/hosts through the Finder?

I'm running OS X Lion 10.7.3.

(Since someone is going to ask, I have a Windows 7 VM in VMware Fusion that likes to change its local connection IP address every time it resumes from suspend (VM pause) or reboots.)

Best Answer

Nothing will break (or hasn't for me whenever I resort to this on occasion) - you'll have to remember to re-do the permissions if and when the OS updates that file systematically. You'll also want to watch the permissions if you ever "repair permissions" since that file is likely recorded in a system receipt. I'd go so far as to set a launchd task to daily enforce your "custom" permissions if you feel it's worth that much work and log something to the console about the need for this "adjustment"

This is a far faster and simpler (and therefore probably better) solution to setting up your own DNS or NIS even though a trip down memory lane would be fun for a few moments:

  • cd /var/yp
  • make