SUMMARY: another "SunOS 4.x mail to root" question

From: Matt Goheen (matt@wbst845e.xerox.com)
Date: Mon Feb 24 1992 - 22:19:27 CST


First, a paraphrase of my original question:

    Some people here, myself included, remote mount /var/spool/mail from our
    central server. This works fine for most people and we can read mail on
    any machine that does the same remote mount. Unfortunately, mail to root
    ends up being delivered to the server -- and the client root thus can't
    read it. I've tried adding an alias on the local machines (i.e. NOT the
    NIS aliases) for root to forward mail to some other user but this doesn't
    appear to work.

    I'd like to get everyone to remote mount mail, but some want local mail to
    root to work or they won't convert -- suggestions?

I received a variety of responces to this. Many suggested using a .forward
file or insuring that newaliases has been run after changing the local alias
file. Neither of these solutions works when mounting the mail spool file
from a remote NFS server using the `OR' sendmail.cf option.

Others asked why users on client machines want to be able to get the client
root's mail. Usually, this is because they run cron jobs as root on their
local machines and don't want to have to redirect the output elsewhere.
Many of our NFS client machines have local data disks.

Still others suggested that I export the NFS mail spool area with root
access (via /etc/exports or equivalent other method). This isn't really
what I want because this allows the client users to delete root's mail on
the server.

Perhaps the best summary of the situation and potential solution (although
I haven't tried it) came from Hal Stern (who else?):

    you're running into the sendmail "remote" option that sunos
    uses as the default for machines that NFS mount /var/spool/mail.

    in your sendmail.cf file, you'll see "OR", which tells
    sendmail to immediately forward mail to "mailhost", or the
    machine exporting /var/spool/mail, instead of attempting local
    delivery. this is why your root's mail is going to
    the mail server.

    the fix is pretty bogus, since you still want normal
    user's mail to go to the mail server. it also requires that
    you run sendmail on each machine, which isn't the best
    use of resources (make sure you have it check the queue once
    an hour or so, since there shouldn't be any "delayed delivery"
    on the local machines -- mail to root should go right through).

    try this:
    (a) on each machine, create a new local alias
            root: localroot@thishost
    (b) put (a) before the + in /etc/aliases, rebuild the aliases file
            on each machine
    (c) in your NIS passwd file, create "localroot" with an entry like
            localroot:*:Root's Mail:/:/etc/nologin

    users who want to read root's mail then do "mail -f /var/spool/mail/localroot"

    gross, but it works.

    --hal

I ended up giving up and leaving it alone. There were several other fine
solutions (included below) which all appear to have merit. But none of them
would really save me much time and/or make things that much more convienent
for the users.

        - Matt Goheen

Thanks to all...
    "John D. Barlow" <John.D.Barlow@arp.anu.edu.au>
    Eddie Brown <eddieb@erc.msstate.edu>
    Hacker Esquire <warren@house.mitre.org>
    JAMES_M._ZIOBRO.WBST102A@xerox.com
    John Valdes <valdes@geosun.uchicago.edu>
    Jon Peatfield (on kronos.amtp.cam.ac.uk) <jp107@amtp.cam.ac.uk>
    Mike.Sullivan@ebay.sun.com (Mike Sullivan { Keeper of the Sacred Word })
    Upkar Singh Kohli <upkar@trace.eng.wayne.edu>
    eckhard@ikarus.ts.go.dlr.de (Eckhard Rueggeberg)
    kayvan@satyr.eng.sun.com (Kayvan Sylvan)
    macphed@dvinci.usask.ca (Ian MacPhedran)
    mdl@cypress.com (J. Matt Landrum)
    mike@inti.lbl.gov (Michael Helm)
    per@erix.ericsson.se (Per Hedeland)
    stern@sunne.east.sun.com (Hal Stern - NE Area Systems Engineer)
    stpeters@dawn.crd.ge.com (Dick St.Peters)
    synapsis!cristian@sun.com (Christian Candia White)

----------
From: per@erix.ericsson.se (Per Hedeland)

With Sun's standard setup for NFS-mounted /var/spool/mail (the 'OR'
option), all locally originated mail is sent to the host that has
/var/spool/mail, no alias checking etc is done - I think this is as it
should be, but there are also a lot of rather more serious problems with
it - let me know if you want a list...

Anyway, the sendmail.cf we use (below) also does this (but has none of
the other problems), however it does have a provision for handling just
the type of problem you encountered, by doing a limited "aliasing" in
the .cf file.

Hope this helps...
--Per Hedeland
per@erix.ericsson.se or
per%erix.ericsson.se@sunic.sunet.se or
...uunet!erix.ericsson.se!per

[ ... sendmail.cf deleted but available on request ... ]

----------
From: "John D. Barlow" <John.D.Barlow@arp.anu.edu.au>

I assume you use NIS ?? This stops local /etc/aliases entries from
working. The following is not a clean solution, so don't
bother reading it if you have an easy answer.

You could set up an alias for every user to forward email to
a "server" machine (doesn't have to be NIS master). This machine
would have to be one under your control, such that root mail
is under your control. Export the /var/spool/mail from this
machine to every other machine, BUT rename it
(like /var/spool/all_mail, or whatever), THEN get all users
home directories and change their .mailrc files to use
/var/spool/all_mail/$USER as the mailbox (remember that this
has more ramifications if you use xmh or other mail readers,
they all need changing).

Now you will have two mail box areas on every machine. One for
the machine itself /var/spool/mail - in which root email will
happily sit. The other in /var/spool/all_mail - in which user
email sits. A bit fiddly, but you could get this to work.
A requirement of this would be the occasional checkup on all
/var/spool/mail on every machine, just to catch stray email ...

OR you could change sndmail somehow on all machines to put roots
email in /roots_email (or other location unique to each machine).
I am still thinking about this last fix.

John Barlow

----------
From: macphed@dvinci.usask.ca (Ian MacPhedran)

Well, IMHO, root mail should go to a central authority.
However, to get the behaviour you want, you could include a rule in each
machine's /etc/sendmail.cf to rewrite "root" to be "root$w", and setup dummy
usernames for these "rootmachine1" "rootmachine2" etc. ...

However, the root users on the various machines would then have to perform
some tricks to read it.
(su rootmachine1; /usr/ucb/mail -f /usr/spool/mail/rootmachine1)

Ian.
Ian MacPhedran, Engineering Computer Centre, University of Saskatchewan.
2B13 Engineering Building, U. of S. Campus, Saskatoon, Sask., CANADA S7N 0W0
macphed@dvinci.USask.CA macphedran@sask.USask.CA

----------
From: Upkar Singh Kohli <upkar@trace.eng.wayne.edu>

The only way I see to have only a single person's mail spooled to
a different ocation than others is specifically link this person's
mail file from within the mounted location to a local location.

ex. /usr/spool/mail is mounted from /net/server/mail
but /usr/spool/mail/root -> /usr/root (or some local location)

Upkar



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:36 CDT