[Discuss] send email from script as non-root

Kent Borg kentborg at borg.org
Sat Jan 23 17:39:01 EST 2021


, On 1/23/21 1:39 PM, David Kramer wrote:
> As part of my home automation, I want a process on my server (which is 
> also my mail server) to send an email (actually an SMS throught he 
> email gateway).  The process that needs to do it is not run as root 
> though, it's running as a mortal user.  I've tried mail, sendmail, 
> curl, etc and they complain

I just tried it on my notebook running the still-testing version of 
Debian, and it let me invoke /sbin/sendmail:

> kentborg at tinpan:~$ /sbin/sendmail kentborg
> test
> .
>
> kentborg at tinpan:~$

And I got it. Locally sendmail is part of Exim. And I only sent locally, 
BTW.


I tried it on both of my Debian/Postfix e-mail servers and they both 
worked, too:

> entborg at mail:~$ /sbin/sendmail kentborg
> test
>
> .
> kentborg at mail:~$

Moments later, at the other end if the country, Thunderbird told me I 
had an new e-mail. Sent a similarly minimal e-mail to my gmail-hosted 
work account worked, but landed in the spam folder, presumably because 
it was too minimal. (No from, no subject, no nothin' but a recipient and 
tiny body.)

So it is possible, and I guess it depends on details of how Postfix is 
installed; but Debian installed Postfix and Exim for me, I don't know 
details beyond minimal configuring of the two Postfix instances.


-kb




More information about the Discuss mailing list