mail from: field question
Mike Bristow
mike at urgle.com
Thu Jan 10 04:14:38 PST 2008
[ apologies to Jim Bow who gets this twice due to my fingers typing
faster than my brain. ]
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).
I expect you can do the same thing with sudo with something like
'sudo bash -login' or similar.
> The only way I can get it to be sent from root is if I explicitly login as
> root.
>
>> Make sure the results are the same (if they're not, the MTA isn't
> > the problem).
>
> So it looks like it isn't. What can be the cause of this then?
The extra things the shell does when running as a login shell; in
particular clearing the enviroment and setting things like LOGNAME
and USER (which I expect /usr/bin/mail and others pay attention to).
--
Shenanigans! Shenanigans! Best of 3!
-- Flash
More information about the freebsd-questions
mailing list