Automatically change /etc/hosts on OS X 10.6
I edit /etc/hosts
as a first line of defense to stop me going to certain distracting sites during the working day.
Ideally I'd like to have two versions of hosts
and a cron job that switches them at 9am and 5pm during the day, but I think that there is a permissions issue running cron
under sudo
... should I just reduce the permissions on hosts
?
You shouldn't need to change permissions of any system file.
I don't see any issue just doing everything under root
, i.e. by opening a root shell, and editing the crontab.
sudo -i
crontab -e
You can also directly edit root
's crontab with:
sudo crontab -u root -e