Re: mail from: field question
- From: Ian Smith <smithi@xxxxxxxxxxxxx>
- Date: Fri, 11 Jan 2008 15:14:56 +1100 (EST)
On Thu, 10 Jan 2008 13:22:47 +0000 Jim Bow <jimbow@xxxxxxxx> wrote:
Mike Bristow wrote:
On Thu, Jan 10, 2008 at 10:46:30AM +0000, Jim Bow wrote:
If I run the script (or just send a mail) on the command line using sudo,
then it's sent as me and not root. Same happens if I su to root first.
use 'su -'. It means you get a login shell (which sets up the enviroment
in the same way that login does).
That makes perfect sense, but doesn't seem to work. Here's the output of
my terminal session:
host% sudo su - (tried doing "su -" also, with same results)
host# cat /etc/motd | mail -s "hello" test@xxxxxxxxxxx
This results in the mail from: header of jim@xxxxxxxxxxxxxxxxx I've
tried this on two different hosts with the same result.
I can confirm this behaviour, also using csh and sendmail, and 'su -'
from originally having logged in as myself, since freebsd 2.2 ..
I use this csh alias whenever not entirely sure who or where I am ..
paqi# alias um
tty;id -p;who am i
groups wheel operator network
root ttyp3 Jan 11 14:09
Note 'id -p' showing 'login smithi'; see id(1) .. I gather that sendmail
must also use getlogin(2) - which value does not appear in `env` - when
sending mail from an su'd session, as opposed to an original root login,
and don't know whether or how this may be configurable in sendmail.
paqi# mail smithi
Received: from paqi.nimnet.asn.au (localhost.nimnet.asn.au [127.0.0.1])
by paqi.nimnet.asn.au (8.13.8/8.13.8) with ESMTP id m0B2gGpU059565
for <smithi@xxxxxxxxxxxxxxxxxx>; Fri, 11 Jan 2008 13:42:16 +1100 (EST)
Received: (from root@localhost)
by paqi.nimnet.asn.au (8.13.8/8.13.8/Submit) id m0B2gFPr059564
for smithi; Fri, 11 Jan 2008 13:42:15 +1100 (EST)
Date: Fri, 11 Jan 2008 13:42:15 +1100 (EST)
From: Ian Smith <smithi@xxxxxxxxxxxxxxxxxx>
Note 'received from root@localhost' but 'envelope-from smithi'. Also
note I'm not using domain masquerading here, as I don't actually mail
out from this box currently.
The actual thing Im trying to do is to email something from a script
that runs as root from devd, but I run into the same problem of the
email arriving from somebody other than root, hence trying this manually
on the command line.
Hmm .. I know mail sent from cron scripts properly comes 'from root',
and don't know why scripts run as root from devd would be any different.
Is 'somebody other than root' consistent, and someone who's logged in,
perhaps before su'ing and then starting the session that invokes devd?
There is definitely something that I am overlooking, but what is it? I'm
extremely curious to work-out why I'm seeing such behavior as its
defeating all my expectations so far.
I noticed later that Paul gets a different result .. maybe postfix as
mentioned, if Paul was starting from an su'd session, not a root login?
freebsd-questions@xxxxxxxxxxx mailing list
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"
- Re: mail from: field question
- From: Jim Bow
- Re: mail from: field question
- Prev by Date: configure printers
- Next by Date: Re: configure printers
- Previous by thread: Re: mail from: field question
- Next by thread: Re: mail from: field question