[ale] odd email issue

Geoffrey Myers lists at serioustechnology.com
Wed Jun 15 14:42:23 EDT 2011


Lightner, Jeff wrote:
> In my earlier email I suggested checking environment differences and
> specifically mentioned PATH.  In subsequent emails I've mentioned the
> environment each time and so far I don't see that the suggested
> comparison of environments for the root and normal user or cron and CLI
> has been done.

I've compared the environments.  I've used fully qualified paths in my 
latest examples, although I resolved that early on.

I don't see how it is remotely possible for an email from one user to 
use a different server then another.  I do recall there used to be an 
env variable defining the smtp server, but there is no reference to any 
email server in the environment of either user.

I think my latest posting is pretty clear.  CLI from user works, 'su -' 
to root does not.  Fully qualified paths for both date and mail used.

>   
> -----Original Message-----
> From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of JD
> Sent: Wednesday, June 15, 2011 1:46 PM
> To: Atlanta Linux Enthusiasts
> Subject: Re: [ale] odd email issue
> 
> I don't know how much help I can be, but ...
> 
> 'date|mail user at domain'
> 
> is trusting the $PATH. This is never a good idea in scripts.
> 
> /bin/date |/usr/bin/mail user\@domain
> 
> would be better and limit the environment a little more.
> Also, in bash, you may need to escape the '@' with a \@.
> On servers, /bin/sh for root may point to /bin/dash, not bash, leading
> to other, unexpected behaviors.
> 
> Probably nothing you don't already know and understand. If I were
> troubleshooting this, I'd put everything into a script file, turn up
> messages and look for the differences between each uid.  Cron definitely
> doesn't bring the expected environment with it. It never has.
> 
> 
> On 06/15/2011 12:24 PM, Geoffrey Myers wrote:
>> Lightner, Jeff wrote:
>>> Since you have the issue running it as root from CLI then it makes
> sense
>>> it has same issue from root cron.   Try running it in your user cron
>>> instead.  (i.e. as your normal user run "crontab -e" and add the job
>>> there.)
>>>
>>> If that works then it may still have to do with environment
> differences
>>> between root and your normal user.   If you're becoming root by doing
>>> "su -" try doing "su" without the dash instead - that way your root
>>> session inherits the original user's environment instead of invoking
>>> root's environment.  If the command then works from CLI as root then
> you
>>> know it is an environmental difference.
>> How is it possible that root could be using a different outgoing mail 
>> server?  Sendmail is configured for localhost only.  This is the part 
>> that is confusing to me.
>>
>>> -----Original Message-----
>>> From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
>>> Geoffrey Myers
>>> Sent: Wednesday, June 15, 2011 9:51 AM
>>> To: Atlanta Linux Enthusiasts
>>> Subject: Re: [ale] odd email issue
>>>
>>> Lightner, Jeff wrote:
>>>> Is the cron job you're running the user's cron or root's cron?
>>> root cron.
>>>
>>>> -----Original Message-----
>>>> From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
>>>> Geoffrey Myers
>>>> Sent: Wednesday, June 15, 2011 9:20 AM
>>>> To: Atlanta Linux Enthusiasts
>>>> Subject: Re: [ale] odd email issue
>>>>
>>>> Geoffrey Myers wrote:
>>>>> David Tomaschik wrote:
>>>>>> On Wed, Jun 15, 2011 at 8:52 AM, Geoffrey Myers
>>>>>> <lists at serioustechnology.com> wrote:
>>>>>>> Robert Coggins wrote:
>>>>>>>> On 6/15/2011 8:11 AM, Geoffrey Myers wrote:
>>>>>>>>> So, I've got sendmail configured so it uses localhost for
> sending
>>>> email.
>>>>>>>>>    As a normal user I can send email like this:
>>>>>>>>>
>>>>>>>>> date|mail email at domain
>>>>>>>>>
>>>>>>>>> Yet, I've recently configured /etc/aliases to send root email
> to
>>>> my
>>>>>>>>> personal email address:
>>>>>>>>>
>>>>>>>>> root:           email at domain
>>>>>>>>>
>>>>>>>>> But I get delayed email messages from 1and1, my domain host for
>>>> these
>>>>>>>>> emails because my machine name (centsovm.serioustechnology.com)
>>> is
>>>> not
>>>>>>>>> valid.
>>>>>>>>>
>>>>>>>>> So, how is this possible?
>>>>>>>>>
>>>>>>>> Maybe it has something to do with not being able to contact that
>>>>>>>> server.  I cannot resolve that address.
>>>>>>> The issue is, when I send it from the command line, it is
>>> apparently
>>>>>>> using my localhost.  When the cron job runs and redirects email
> via
>>>>>>> /etc/aliases, it appears to be using the mail server for my
> hosting
>>>> company.
>>>>>>> Why the inconsistency?
>>>>>>>
>>>>>>> Really, how is this even possible?
>>>>>> Do you have sendmail configured to use a relayhost?  Would you
> mind
>>>>>> putting headers from the two different emails on a pastebin
>>> somewhere
>>>>>> for comparison?
>>>>> No relayhost.  I'll see if I can get some useful header info.  What
> 
>>>>> baffles me is it appears that this one machine uses localhost from
>>> the
>>>>> command line and my hosting company mail server for cron output.
>>>>>
>>>>> How is that even possible?
>>>> Here's more to this oddity.  I run this on the command line as my
>>> normal
>>>> user:
>>>>
>>>> date|mail user at domain
>>>>
>>>> where I'm sending email to my email address.  Comes through fine.
>>>>
>>>> If I do the same thing as root, the email does not come through.
>>>>
>>>> ????
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>  
> Proud partner. Susan G. Komen for the Cure.
>  
> Please consider our environment before printing this e-mail or attachments.
> ----------------------------------
> CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.
> ----------------------------------
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo


-- 
Until later, Geoffrey

"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson


More information about the Ale mailing list