• The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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