The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - Newcomers (http://hintsforums.macworld.com/forumdisplay.php?f=15)
-   -   root .forward not working (http://hintsforums.macworld.com/showthread.php?t=18265)

mnewman 12-05-2003 05:51 PM

root .forward not working
 
Pre-Panther I had set up root's .forward file so that mail to root would get sent to me (at my ISP IMPAP acct). Installing Panther removed the old .forward file and replaced it with one showing /dev/null.

I edited that to replace it with my e-mail address, but mail to root seems to still go to /dev/null

I know postfix is working because I can send mail to me. It's just that root's .forward file doesn't seem to work.

There's nothing for root in the mail queue.

mervTormel 12-05-2003 06:15 PM

send an email to root.

do you expect mail from root? the maintenance jobs? might need to review the periodic config file to see that it mails rather than logs.

mnewman 12-05-2003 07:37 PM

Mail to root ends up in a black hole.

Mail to me (at my ISP) works fine.

Pre-Panther, all cron job stuff was mailed to root and forwarded to me at my ISP.

Post-Panther install mail to root was being delivered to me at my local account:

Code:

Message 7:
From root@imac-newman.local  Sat Dec  6 07:53:58 2003
X-Original-To: root@imac-newman.local
Delivered-To: mnewman@imac-newman.local
From: root@imac-newman.local (Cron Daemon)
To: root@imac-newman.local
Subject: Cron <root@imac-newman> /Library/Application\ Support/MacaroniTool
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin>
X-Cron-Env: <HOME=/var/root>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Date: Sat,  6 Dec 2003 00:06:39 +1000 (ChST)

2003-12-06 00:00:00.995 MacaroniTool[14753] Running Daily Unix Maintenance
2003-12-06 00:00:06.020 MacaroniTool[14753] Running CCC

Anyway, after I saw the above I looked at root's .forward file and found that it had reverted back to /dev/null. I changed to it my ISP address, but no joy....

Now, mail to root goes nowhere.

Does postfix somehow ignore the .forward file and look somewhere else?

mervTormel 12-05-2003 07:56 PM

mail to root works here, a la postfix OSX 10.3.1

root .forward contains my username

is your ISP blocking relays? there should be a lot of entries in mail.log when postfix fires up.

perhaps postfix is bork'd ?

report:

sudo mailq

mnewman 12-05-2003 09:02 PM

Here's a mail.log entry for when sendmail was properly forwarding mail addressed to root to me:

Code:

Oct 31 16:57:36 imac-newman sendmail[13060]:
 h9V6o1X2013060: from=root, size=404, class=0,
 nrcpts=1, msgid=<200310310650.h9V6o1X2013060@imac-newman.local>,
 relay=root@localhost
Oct 31 16:57:36 imac-newman sendmail[13276]:
 h9V6vahJ013276: from=<root@imac-newman.local>,
 size=681, class=0, nrcpts=1, msgid=<200310310650.h9V6o1X2013060@imac-newman.local>,
 proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Oct 31 16:57:36 imac-newman sendmail[13060]:
 h9V6o1X2013060: to=root, ctladdr=root (0/0), delay=00:07:35, xdelay=00:00:00,
 mailer=relay, pri=30273, relay=localhost [127.0.0.1], dsn=2.0.0, stat=Sent
 (h9V6vahJ013276 Message accepted for delivery)
Oct 31 16:57:38 imac-newman sendmail[13277]:
 h9V6vahJ013276: to=mnewman@saipan.com, ctladdr=<root@imac-newman.local>
 (0/0), delay=00:00:02, xdelay=00:00:02, mailer=relay, pri=30912,

relay=mail.saipan.com. [202.128.27.5], dsn=2.0.0,
 stat=Sent (ok 1067582744 qp 9677)

Notice that it addresses the mail to "mnewman@saipan.com"

Now, here's a mail log entry for when postfix fails to properly forward the mail:

Code:

Dec  6 11:49:39 localhost postfix/pickup[762]:
 831CE172787: uid=501 from=<mnewman>
Dec  6 11:49:39 localhost postfix/cleanup[763]:
 831CE172787: message-id=<20031206014939.831CE172787@postfix.mgnewman.com>
Dec  6 11:49:39 localhost postfix/qmgr[708]:
 831CE172787: from=<mnewman@mgnewman.com>, size=319, nrcpt=1 (queue active)
Dec  6 11:49:41 localhost postfix/smtp[765]:
 831CE172787: to=<root@mgnewman.com>,
 orig_to=<root>,
relay=mail.saipan.com[202.128.27.5], delay=2, status=sent (250 ok 1070675380 qp 17601)

Note that it addresses the mail not to "info@mgnewman.com" which is what is in root's .forward. Instead it is addressing the mail to root@mgnewman.com. No wonder it's not going anywhere because there is no mailbox for "root" at mgnewman.com.

It looks to me like I've somehow screwed up forwarding in postfix....

There is nothing recent in the mailq.

mnewman 12-05-2003 09:46 PM

So, I created mail account called:

root@mgnewman.com

And, sure enough, that's where procmail is forwarding root's mail, even though:

Code:

[imac-newman:/var/root] mnewman% cat .forward
info@mgnewman.com

So, how do I get procmail to forward mail to a real e-mail address instead of root@whateverdomain?

breen 12-06-2003 02:57 PM

I'd declare an alias for root in /etc/aliases.

Code:

[...]
root:          info@mgnewman.com
[...]

Then run newaliases

mnewman 12-06-2003 04:20 PM

Sorry, still mails to root@mgnewman.com

Code:

Dec  7 07:16:08 localhost postfix/smtp[1575]: 51D5A173B3D:
 to=<root@mgnewman.com>

One other oddity. I ran "repair permissions" just for yucks. This operation changed all of the postfix directories to be owned by root. For example:

Code:

Dec  7 07:01:54 localhost postfix/postfix-script:
warning: not owned by postfix: /private/var/spool/postfix/maildrop

So, postfix refused to start when I rebooted my machine. I went back and changed all these directories to be owned by postfix and then I could start postfix. I wonder if this is going to happen every time I repair permissions?

If so, it seems like Apple hasn't much thought through this postfix implementation.

stetner 12-06-2003 08:50 PM

Try running postfix in verbose mode to see if there are any errors. Maybe it is not reading the aliases db due to permissions or some such thing (although I would expect that to come out in the normal logs)
Code:

      -v    Enable verbose  logging  for  debugging  purposes.  Multiple  -v
              options make the software increasingly verbose.

Something must be causing the rewrite to root @ your forwarded machine.....

As well, I do not use a .forward for root at all, I just have this line set in the /etc/aliases:
Code:

# Person who should get root's mail. Don't receive mail as root!
root:          stetner

Although it is not redirecting to another machine, it is getting to me locally.

mnewman 12-06-2003 10:30 PM

stetner,

Thank you. Verbose logging revealed that I had improperly set (and misunderstood) the myorigin parameter. Once I fixed that mail to root works OK.

Thanks again.

mervTormel 12-06-2003 11:05 PM

pilot error!

mnewman 12-06-2003 11:07 PM

Quote:

Originally posted by mervTormel
pilot error!
To be expected, I hope, in the "Newcomers" forum. I'm here to learn, and I am!

stetner 12-07-2003 08:33 PM

That's all right, I fought with a configuration issue for half a day before I finally turned on verbose logging and realised that there was a line at the bottom of a config file that was undoing what I was trying to do :rolleyes:

breen 12-08-2003 11:22 AM

We've all been there!

Glad you got it running properly.

Breen

mnewman 12-08-2003 02:25 PM

Unfortunately, I'm still having problem.

I know that all the directories in:

Code:

/private/var/spool/postfix/
are supposed to be owned by user postfix.

But, for some reason, they keep getting changed to be owned by user 27, which is not a valid UID on my system.

If I go back and chown everything to postfix, it all works until "Repair Permissions" screws things up again:

Code:

User differs on ./private/var/spool/postfix/active, should be 27,
 owner is 255
Owner and group corrected on ./private/var/spool/postfix/active

So, should I change the UID for postfix to be 27, or is there some way I can fix "Repair Permissions" so that it doesn't mess things up every night....

And, what should the group be (and GID) for this set of directories?

stetner 12-08-2003 06:56 PM

Quote:

Originally posted by mnewman
Unfortunately, I'm still having problem.

I know that all the directories in:

Code:

/private/var/spool/postfix/
are supposed to be owned by user postfix.

But, for some reason, they keep getting changed to be owned by user 27, which is not a valid UID on my system.
The postfix UID is supposed to be 27. I would go into netinfo manager and correct it. After that, you could do
Code:

$ find / -user 255 -print0 | xargs -0 chown 27
which will change all the files from the old UID of 255 to 27. For what it is worth, here is what my dir looks like:
Code:

$ sudo ls -l /private/var/spool/postfix
Password:
total 0
drwx------  18 postfix  wheel        612 Nov  1 04:10 active
drwx------  11 postfix  wheel        374 Dec  8 07:10 bounce
drwx------    2 postfix  wheel          68 Sep 26 16:25 corrupt
drwx------  12 postfix  wheel        408 Dec  7 22:10 defer
drwx------  12 postfix  wheel        408 Dec  7 22:10 deferred
drwx------    2 postfix  wheel          68 Sep 26 16:25 flush
drwx------    2 postfix  wheel          68 Sep 26 16:25 hold
drwx------  18 postfix  wheel        612 Dec  9 09:30 incoming
drwx-wx---    2 postfix  postdrop      68 Dec  9 09:30 maildrop
drwxr-xr-x  11 root    wheel        374 Nov 15 21:05 pid
drwx------  18 postfix  wheel        612 Dec  8 16:38 private
drwx--x---    7 postfix  postdrop      238 Dec  8 16:38 public

$ sudo ls -nl /private/var/spool/postfix
total 0
drwx------  18 27      0            612 Nov  1 04:10 active
drwx------  11 27      0            374 Dec  8 07:10 bounce
drwx------    2 27      0              68 Sep 26 16:25 corrupt
drwx------  12 27      0            408 Dec  7 22:10 defer
drwx------  12 27      0            408 Dec  7 22:10 deferred
drwx------    2 27      0              68 Sep 26 16:25 flush
drwx------    2 27      0              68 Sep 26 16:25 hold
drwx------  18 27      0            612 Dec  9 09:30 incoming
drwx-wx---    2 27      28            68 Dec  9 09:30 maildrop
drwxr-xr-x  11 0        0            374 Nov 15 21:05 pid
drwx------  18 27      0            612 Dec  8 16:38 private
drwx--x---    7 27      28            238 Dec  8 16:38 public

You should also have the postdrop group at GID 28 and the postfix group as GID 27.

mnewman 12-09-2003 01:13 AM

I tried to use "find" as described above to change the ownership, but I get this:

Code:

[imac-newman:~] mnewman% sudo find / -user 255 -print0 | xargs -0 chown 27
chown: changing ownership of
 `/private/var/spool/postfix/active':
 Operation not permitted
chown: getting attributes of
 `/private/var/spool/postfix/active/0':
 Permission denied

So, I tried a recursive chown:

Code:

[imac-newman:~] mnewman% sudo chown -R postfix /private/var/spool/postfix/
and that seemed to have worked.

At least postfix is up and running again.

For now....

mervTormel 12-09-2003 01:29 AM

Code:

$ sudo find / -user 255 -print0 | xargs -0 chown 27
the reason the chown failed is because the sudo only applied to the find command. xargs was run as your login account. the solution would be a sudo xargs after the pipe char |

stetner 12-09-2003 01:39 AM

Sorry, I forgot to say do a 'sudo -s' first :(

I really tend to avoid recursive chown/chgrp/chmods unless I am totally sure what is down the tree....

On my system the pid files are all owned by root. There may be a security reason for this (or my system could be messed up :) Anyone have a clean install to check this?)
Code:

# pwd
/private/var/spool

# find files not owned by postfix
# find postfix/  \! -user  27
postfix/
postfix//pid
postfix//pid/inet.smtp
postfix//pid/master.pid
postfix//pid/unix.bounce
postfix//pid/unix.cleanup
postfix//pid/unix.defer
postfix//pid/unix.flush
postfix//pid/unix.local
postfix//pid/unix.showq
postfix//pid/unix.smtp

# ls -l postfix/pid/
total 4
-rw-------    1 root    wheel          0 Oct 29 22:58 inet.smtp
-rw-------    1 root    wheel          17 Dec  8 16:39 master.pid
-rw-------    1 root    wheel          0 Nov 15 21:05 unix.bounce
-rw-------    1 root    wheel          0 Oct 29 15:39 unix.cleanup
-rw-------    1 root    wheel          0 Nov 12 23:11 unix.defer
-rw-------    1 root    wheel          0 Nov 12 23:11 unix.flush
-rw-------    1 root    wheel          0 Oct 29 19:57 unix.local
-rw-------    1 root    wheel          0 Oct 29 15:39 unix.showq
-rw-------    1 root    wheel          0 Oct 29 15:39 unix.smtp

#


mnewman 12-09-2003 01:45 AM

I checked another system. pid and all of the files in pid are owned by root. I've now fixed that. Postfix is still running....

Thanks for your help.

I learned a lot.

mervTormel 12-09-2003 01:58 AM

check
 
Code:

$ ls -l /var/spool/postfix/pid/
total 4
-rw-------    1 root    wheel          17 Dec  8 18:00 master.pid
-rw-------    1 root    wheel          0 Nov 13 09:49 unix.bounce
-rw-------    1 root    wheel          0 Nov  2 14:02 unix.cleanup
-rw-------    1 root    wheel          0 Dec  4 02:22 unix.defer
-rw-------    1 root    wheel          0 Dec  4 02:22 unix.flush
-rw-------    1 root    wheel          0 Nov  2 14:02 unix.local
-rw-------    1 root    wheel          0 Nov  5 14:43 unix.showq
-rw-------    1 root    wheel          0 Nov 13 09:49 unix.smtp


mnewman 12-09-2003 03:07 AM

Same, same here.

Thanks.

You know, I really appreciate the help I've gotten in these forums over the past few years.

I'm old (55) and don't learn new tricks very well. And, I don't have time to spend hours at the unix command line. But, I do enjoy learning and I do have a few command line tasks that I need to do now and then. And, living on a small island I don't really have anywhere to go for help.

So, the assistance I've received from folks like you all is sincerely and ernestly appreciated.

Mike

stetner 12-09-2003 06:45 AM

Glad we can help Mike! Hey, someone once told me that 'old' people are people who are more than 15 years older than you are, so since I am 42, you are not old! :D

Just had a look at your web page Mike, quite comprehensive!

Saipan looks pretty good, very similar to a lot of tropical countries. I currently live on a big island ;) to the south (I am a dual citizen now, Canadian-Australian), but have visited many of the countries around here (including Chuuk) as I am an avid scuba diver and I love all the WWII wrecks in the south pacific.

I love getting away to some of those places, but I can see how some people go stir crazy after a while.

Anyway, if you ever need a hand, just pay my airfare and I will come up and help you with any Mac problems (between dives that is)! :)

mnewman 12-09-2003 01:57 PM

Stetner,

Tried to send this to your private box, but it's full....

=====

I may have mentioned this before, but we have friends who live in Brisbane (Ascot, not far from Eagle Farm) whom we visit every other year or so. Next time we're down we'll have to have a beer or coffee somewhere. Maybe even a dive?

Thanks again,

Mike


All times are GMT -5. The time now is 10:42 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.