A login script to fix sendmail permissions

May 05, '02 12:08:15PM

Contributed by: jpbjpbjpb

I have seen a bunch of different threads on different mailing lists regarding problems with Sendmail on OS X because of permission problems. To make life easier, I created this StartupItem to deal with the problem. This has been tested on 10.1.4. I run postfix instead of Sendmail, so this isn't an issue for me, but in the interest of being helpful, here's a fix.

This startup item fixes the permissions on /, /etc and /etc/mail so that Sendmail (as distributed with 10.1.4 at least) will run. Read the rest of the article for the scripts...

[Editor's note: I had a minor database glitch this morning, and I just noticed that this article was under my by-line. I have now corrected it to reflect the original submitter; my apologies for the incorrect attribution!]

To install this script, log in as an administrator and create a folder named KeepSendmailHappy in /Library/StartupItems. If your system doesn't have /Library/StartupItems, go ahead and make it, but make sure you get the spelling correct. Once created, 'cd' into the new KeepSendmailHappy folder. Create a file called KeepSendmailHappy with the following contents:

#!/bin/sh
#
# Fix permissions on /, /etc and /etc/mail to keep Sendmail happy

. /etc/rc.common

case "$1" in
start)
ConsoleMessage "Fixing permissions on /, /etc and /etc/mail"
chmod g-w / /etc /etc/mail
;;
esac

exit 0
Then, sudo chmod 755 KeepSendmailHappy. Now create a file named StartupParameters.plist with the following contents:
{
Description = "Keep Sendmail Happy";
Provides = ("HappySendmail");
Requires = ("Resolver");
OrderPreference = "None";
Messages =
{
start = "Fixing permissions on /, /etc and /etc/mail";
stop = "Fixing permissions on /, /etc and /etc/mail";
restart = "Fixing permissions on /, /etc and /etc/mail";
};
}
The latest version of this script is always available for download at apesseekingknowledge.net.

Comments (11)


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