PDA

View Full Version : sendmail


killydoon
02-01-2002, 06:52 PM
I recently read that OS X should stay on continuously because it does various things in the middle of the night. This I have done for the last couple nights to see what happens. I ran the Console program to keep track of events. In the mornings, I noticed that something kept trying to use "sendmail", without success, evidently. My computer is not normally connected to the net. Whatever tried to use sendmail, tried several times over several minutes, once the first night and twice the second. Below is an example from the log:

Feb 1 05:31:01 localhost sendmail[736]: My unqualified host name (localhost) unknown; sleeping for retry

Feb 1 05:32:01 localhost sendmail[736]: unable to qualify my own domain name (localhost) -- using short name

Feb 1 05:32:01 localhost sendmail[736]: NOQUEUE: SYSERR(root): /etc/mail/sendmail.cf: line 81: fileclass: cannot open /etc/mail/local-host-names: Group writable directory

When I looked into the var/log/mail.log file, I noticed that sendmail did the same thing before, a few time with success, apparently. The successful ones were sent when I was probably connected to the internet. They are not mine, I don't think, because they only happen sometimes (2 times last June, 4 times in Nov, 6 times in Dec, 2 times in Jan) and I am on the net most days. The following are apparently successful sendings of something:

Dec 17 09:11:22 localhost sendmail[358]: fBH9BM400358: from=root, size=1051, class=0, nrcpts=1, msgid=<200112170911.fBH9BM400358@localhost>, relay=root@localhost

Dec 17 09:11:22 localhost sendmail[360]: fBH9BM400358: to=/dev/null, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=*file*, pri=31051, dsn=2.0.0, stat=Sent

What is happening here? What is being sent to whom? How can I stop this from happening?

Craig R. Arko
02-01-2002, 07:13 PM
After running the nightly, weekly and monthly maintenance task, cron (the program responsible for scheduling these tasks) attempts to send an email message to root with the results.

Since sendmail is configured to not work out of the box on OS X, these attempts fail, and write a log entry about it.

It would be unlikely that it would work sometimes, and not others, unless you had deliberately taken the steps needed to enable sendmail; it's not something that could happen by accident. :)

mervTormel
02-01-2002, 07:23 PM
first off, if your root dir is group writable, sendmail screeches about it. this was a doosey to find because the dir it reports in the error:

cannot open /etc/mail/local-host-names: Group writable directory

was not group writable. but, following it back up the dir chain, i find that the root dir / is group writable:

% ls -ld /
drwxrwxr-t 42 root admin 1384 Feb 1 09:09 /

so then

% sudo chmod g-w /

% ls -ld /
drwxr-xr-t 42 root admin 1384 Feb 1 09:09 /

and sendmail will stop sqealing about that. i think.


then, navigate to the root users default dir, /var/root and create a .forward file so that email to root is forwarded to your username

% cd /var/root
% su
Password:

# echo "username" > .forward
# cat .forward
username

# chmod u=rw,go= .forward
# ll
-rw------- 1 root wheel 5 Feb 1 16:12 .forward

# exit


as for the host/domain errors, you may need to edit /etc/hostconfig and name your box ?

% cat /etc/hostconfig
##
# /etc/hostconfig
##
# This file is maintained by the system control panels
##

# Network configuration
# HOSTNAME=-AUTOMATIC-
HOSTNAME=thisldo # <- give your monster a name
ROUTER=-AUTOMATIC-


get that done and let us know.

-mt

mervTormel
02-01-2002, 07:30 PM
craig,

i cannae remember doing anything about cron's sendmail failures except what i outlined above.

and since % mail is so squirrely, i put a .forward in my $HOME to forward any local email to my ISP.

so now, my favorite email client gets messages from cron root and anacron root for centralized filing.

you can test this by creating that .forward and:

% mail <me>
subject: test
test
^D
EOT
%

[ bronx cheer ]

-mt

Titanium Man
02-02-2002, 12:53 AM
Hey MT, thanks for the setup tips. How do you forward mail to your favorite email app? I've managed to get it to go to Mail, but it doesn't appear in the "Active" folder, it appears in the personal mailbox. Furthermore, since I believe you use Entourage, how would I get mail forwarded so I could pick it up there? Thanks

mervTormel
02-02-2002, 01:27 AM
TiMan,

all we're doing is giving a directive for the unix mail facility (q.v. % man mail) to forward local account emails.

the contents of the .forward file is a list of valid email addresses.

therefore, it could be like:

% cat .forward
otherUserOnLocalHost
mySpoof@yahoo.com
myUsername@theISPthatTakesMyMoneyEveryMonth.com

my root's .forward just has one entry in it, my OSX login:

host:/var/root # cat .forward
myOSXusername


and myOSXusername .forward has one entry in it:

host:~ % cat .forward
myUsername@theISPofMyEmailHost.com

-names have been changed to protect the innocent

does that help? i don't know about that Mail you speak of and active folder, and personal mailbox. unless you mean Mail.app, and i still don't know. but it's just another email client, no?

Titanium Man
02-02-2002, 01:37 AM
MT, you rock as always! Sorry, I WAS referring to mail.app and was thinking about a post I had seen on macosxhints.com where you could set up a UNIX account and receive your sendmail stuff there (I was also thinking that you'd be able to read my mind and know exactly what I was talking about so I didn't mention that before). But your way is MUCH simpler. Thanks!

killydoon
02-02-2002, 07:45 AM
MT - thanks for the advice. Haven't had the error messages since following your suggestions. Did have a bit of a problem trying to edit the /etc/hostconfig file. It denied me permssion. The permissions were -rw-r--r--. Can't remember enough of my 20 year-old unix classes to know what is safe to change and what is not. I'm not in a rush to change things if they seem to be working.

Different topic - how can you move files from one volume to another? Tried to move a couple files via the terminal from the OS X volume to my OS 9 volume. Instead of moving the files to the other harddisk, it simply put them at the top level on the OS X disk. The target drive does have a space in the name (Drive 9).

Thanks.

killydoon

pmccann
02-02-2002, 10:07 AM
killydoon,

you can just use "mv" as per usual; that command is, as the man page describes, equivalent to the following "group of three" when copying between volumes:

rm -f destination &&\
cp -PRp source destination &&\
rm -rf source

If you want to move "/osx/Users/killy/filetomove" to the Desktop Folder of a volume called "backup volume" you should use the command:

mv /osx/Users/killy/filetomove "/Volumes/backup volume/Desktop Folder"

Maybe the leading "/Volumes" is what you were missing? That's the directory in which all volumes bar the startup volume are mounted. (The quotes ensure that the shell knows the destination directory is *one directory* and not three separate space separated chunks (none of which are likely to exist!). Other ways to do this include single quotes or backslashing, --and hence "escaping"-- the spaces in the directory path. The latter is what you get if you ask the shell to fill in the path to the directory in question by using tab completion.)

Hope that makes some sense.

Paul

mervTormel
02-02-2002, 12:24 PM
Originally posted by killydoon
Did have a bit of a problem trying to edit the /etc/hostconfig file. It denied me permssion. The permissions were -rw-r--r--. Can't remember enough of my 20 year-old unix classes to know what is safe to change and what is not. I'm not in a rush to change things if they seem to be working.

killydoon,

generally, you don't want to change permissions on files unless you know better :D in this case, root owns the hostconfig file, and should, and the perms mask is correct, owner=read/write, group=read, world=read

you need to masquerade as root to make system config changes; sudo is one way...

% sudo pico /etc/hostconfig
password:

Pico being a text editor unencumbered by many scifi keystrokes.

Let us know if your 20 year old unix class notes resurface and make you irritable.

killydoon
02-02-2002, 02:11 PM
Paul,

Thanks again for another suggestion (just read you reply about modifying cron. I did have the "Volumes" but I did left out the quotes. Learning little by little.

MT ,

Those Unix notes are long lost though books abound on Amazon. Will pick one up. Back in those ancient computer days, we worked up the Forth language in Unix (does anyone still remember Forth?). It drove me to by a Mac.

Killydoon

bluehz
02-03-2002, 06:01 AM
Thanks for the great tips above - good stuff!!

I have 86'd my sendmail in OS X 10.1.2 in favor of the highly recommended Postfix SMTP server. Install was a breeze and all is running well. I am wondering though about all those processes that like to use sendmail as default - such as cron, etc. to send mail to root, etc. I have noticed my daily/monthly/weekly cron reports are failing at a certain point where it is trying to send out mail - likely though sendmail.

What do I need to do to transition my setup from sendmail to postfix? What variables, settings, etc. in scripts should I be looking for to change, etc. Note I am not a programmer - so be gentle