• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

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