• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Issue User Cron Script Send eMail

cmak.fr

New Pleskian
Hello

I have a system user with a scheduled task, a "Run a command" task runs a bash script.
The .sh script is run in the chrooted environment as should and works well...
... but the part where it should send an email fails.

Here is the email send command (in script):

/bin/mail -s "The subject" "[email protected]" < $msgfile

This command works fine from root ssh but doesnt from user cron.
Maybe a chroot issue.
Could any one help ?
 
It succeed to add mail but not sendmail and can not send email:

[root@host~]# ./update_chroot.sh --add mail
Done! Do not forget to run 'Work/update_chroot.sh --apply domains...' to apply changes in chroot template to domains.
[root@host ~]# ./update_chroot.sh --add sendmail
Done! Do not forget to run 'Work/update_chroot.sh --apply domains...' to apply changes in chroot template to domains.
[root@host ~]# ./update_chroot.sh --apply all
Applying chrooted environment on mydomain.org: chrootmng: skipping suid or sgid file "/var/www/vhosts/chroot/usr/sbin/sendmail"



With the system user:

bash-4.2$ type mail
mail is hashed (/usr/bin/mail)
bash-4.2$ type sendmail
bash: type: sendmail: not found
bash-4.2$ echo "Testmail" | mail -s "a try" [email protected]
/usr/sbin/sendmail: No such file or directory
"//dead.letter" 9/220
. . . message not sent.
bash-4.2$ ##same if i invoke /usr/bin/mail


Curiosity:


[root@fhost ~]#ls -la /var/www/vhosts/chroot/usr/sbin
total 1132
drwxr-xr-x 2 root root 38 Apr 14 19:39 .
drwxr-xr-x 7 root root 68 Apr 14 19:39 ..
-rwxr-xr-x 2 root root 1065376 Apr 9 19:07 ldconfig
-r-sr-xr-x 1 root root 89336 Sep 27 2018 sendmail


 
Last edited:
@Ales: i did try ssmtp. Quite same issue with guid


[root@host~]
yum install ssmtp
...
Done !

[root@host~] ./update_chroot.sh --add ssmtp
'/usr/sbin/ssmtp' -> '/var/www/vhosts/chroot/usr/sbin/ssmtp'
Done! Do not forget to run './update_chroot.sh --apply domains...' to apply changes in chroot template to domains.
[root@host~] ./update_chroot.sh --apply all
[root@host~]# ls -lah /var/www/vhosts/chroot/sbin/
total 1,2M
drwxr-xr-x 2 root root 51 20 avril 05:47 .
drwxr-xr-x 7 root root 68 14 avril 19:39 ..
-rwxr-xr-x 2 root root 1,1M 9 avril 19:07 ldconfig
-r-sr-xr-x 1 root root 88K 27 sept. 2018 sendmail
-rwxr-sr-x 1 root mail 41K 30 oct. 2014 ssmtp


With the system user:

bash-4.2$ type ssmtp
bash: type: ssmtp: not found
 
I'd remove sendmail from the chroot, change ssmtp binary's permissions and add ssmtp again.

Also, a quick search reveals this (I'm not suggesting a ssmtp recompile, just putting this here as a resource when it comes to ssmtp and chroot).
 
Back
Top