Auto-Reset root permissions

Mar 11, '02 10:08:47PM

Contributed by: geohar

Do you run sendmail, like to have a secure system or does it just plain annoy you that Apple's installer messes with the root permissions. If so, then here's a place to put the script which will save you having to remember to do it yourself.

The script /etc/daily, which runs as root automatically does some tasks each day. However, I'm loathed to mess with these scripts - it's really nasty to install stuff in global scripts, there should be some way to customize without hacking arround to much. Well, there is. /etc/daily checks for a script /etc/daily.local which doesn't exist by default. I'd suggest putting the following in that file (and ensuring it has appropriate permissions). This will keep your root directories permissions neat without much work.

Read on to see the script...

Use pico or the like to make /etc/daily.local

#! /bin/sh

# extra daily tasks
# 1) clean up from apple installers
chmod go-w /
Remove extra write permssions on the script for security
chmod go-w /etc/daily.local
Voilla.

next time /etc/daily runs daily.local will too.

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020311220847942