Swiftmail cannot use sendmail/postfix

When I try to run some Kohana swiftmailer I get the following error in maillog:

Jul 23 17:18:37 ads postfix/sendmail[5818]: fatal: execv /usr/libexec/postfix/smtpd: Permission denied

The output of ls -l /usr/libexec/postfix

total 7116
-rwxr-xr-x. 1 root root 226120 Feb 20 10:07 anvil
-rwxr-xr-x. 1 root root 275752 Feb 20 10:07 bounce
-rwxr-xr-x. 1 root root 383976 Feb 20 10:07 cleanup
-rwxr-xr-x. 1 root root 246696 Feb 20 10:07 discard
-rwxr-xr-x. 1 root root 246696 Feb 20 10:07 error
-rwxr-xr-x. 1 root root 234408 Feb 20 10:07 flush
-rwxr-xr-x. 2 root root 448872 Feb 20 10:07 lmtp
-rwxr-xr-x. 1 root root 337128 Feb 20 10:07 local
-rw-r--r--. 1 root root  26830 Feb 20 10:07 main.cf
-rwxr-xr-x. 1 root root 155976 Feb 20 10:07 master
-rw-r--r--. 1 root root   5113 Feb 20 10:07 master.cf
-rwxr-xr-x. 2 root root 308104 Feb 20 10:07 nqmgr
-rwxr-xr-x. 1 root root 295816 Feb 20 10:07 oqmgr
-rwxr-xr-x. 1 root root 234440 Feb 20 10:07 pickup
-rwxr-xr-x. 1 root root 284104 Feb 20 10:07 pipe
-rw-r--r--. 1 root root  18413 Feb 20 10:07 postfix-files
-rwxr-xr-x. 1 root root   8087 Feb 20 10:07 postfix-script
-rwxr-xr-x. 1 root root   6543 Feb 20 10:07 postfix-wrapper
-rwxr-xr-x. 1 root root  24736 Feb 20 10:07 post-install
-rwxr-xr-x. 1 root root   8419 Feb 20 10:07 postmulti-script
-rwxr-xr-x. 1 root root 213800 Feb 20 10:07 proxymap
-rwxr-xr-x. 2 root root 308104 Feb 20 10:07 qmgr
-rwxr-xr-x. 1 root root 255040 Feb 20 10:07 qmqpd
-rwxr-xr-x. 1 root root 222024 Feb 20 10:07 scache
-rwxr-xr-x. 1 root root 238568 Feb 20 10:07 showq
-rwxr-xr-x. 2 root root 448872 Feb 20 10:07 smtp
-rwxr-xr-x. 1 root root 531616 Feb 20 10:07 smtpd
-rwxr-xr-x. 1 root root 222208 Feb 20 10:07 spawn
-rwxr-xr-x. 1 root root 234568 Feb 20 10:07 tlsmgr
-rwxr-xr-x. 1 root root 242896 Feb 20 10:07 trivial-rewrite
-rwxr-xr-x. 1 root root 230280 Feb 20 10:07 verify
-rwxr-xr-x. 1 root root 275464 Feb 20 10:07 virtual

I have attempted to run rpm -qa | xargs rpm --setugids

However this does not seem to solve the issue.

Answer

This is just a hunch but I’m suspecting that you may be using PHP’s safe_mode function as shown at http://php.net/manual/en/ini.sect.safe-mode.php. It would be plausible that the executable lies outside of safe_mode_exec_dir and as such PHP is refusing to execute it.

There isn’t anything wrong with the permissions of your /usr/libexec/postfix directory. The permissions are the exact same on my CentOS 6.5 machine:

 total 7116
-rwxr-xr-x 1 root root 226120 Feb 20 03:07 anvil
-rwxr-xr-x 1 root root 275752 Feb 20 03:07 bounce
-rwxr-xr-x 1 root root 383976 Feb 20 03:07 cleanup
-rwxr-xr-x 1 root root 246696 Feb 20 03:07 discard
-rwxr-xr-x 1 root root 246696 Feb 20 03:07 error
-rwxr-xr-x 1 root root 234408 Feb 20 03:07 flush
-rwxr-xr-x 2 root root 448872 Feb 20 03:07 lmtp
-rwxr-xr-x 1 root root 337128 Feb 20 03:07 local
-rw-r--r-- 1 root root  26830 Feb 20 03:07 main.cf
-rwxr-xr-x 1 root root 155976 Feb 20 03:07 master
-rw-r--r-- 1 root root   5113 Feb 20 03:07 master.cf
-rwxr-xr-x 2 root root 308104 Feb 20 03:07 nqmgr
-rwxr-xr-x 1 root root 295816 Feb 20 03:07 oqmgr
-rwxr-xr-x 1 root root 234440 Feb 20 03:07 pickup
-rwxr-xr-x 1 root root 284104 Feb 20 03:07 pipe
-rw-r--r-- 1 root root  18413 Feb 20 03:07 postfix-files
-rwxr-xr-x 1 root root   8087 Feb 20 03:07 postfix-script
-rwxr-xr-x 1 root root   6543 Feb 20 03:07 postfix-wrapper
-rwxr-xr-x 1 root root  24736 Feb 20 03:07 post-install
-rwxr-xr-x 1 root root   8419 Feb 20 03:07 postmulti-script
-rwxr-xr-x 1 root root 213800 Feb 20 03:07 proxymap
-rwxr-xr-x 2 root root 308104 Feb 20 03:07 qmgr
-rwxr-xr-x 1 root root 255040 Feb 20 03:07 qmqpd
-rwxr-xr-x 1 root root 222024 Feb 20 03:07 scache
-rwxr-xr-x 1 root root 238568 Feb 20 03:07 showq
-rwxr-xr-x 2 root root 448872 Feb 20 03:07 smtp
-rwxr-xr-x 1 root root 531616 Feb 20 03:07 smtpd
-rwxr-xr-x 1 root root 222208 Feb 20 03:07 spawn
-rwxr-xr-x 1 root root 234568 Feb 20 03:07 tlsmgr
-rwxr-xr-x 1 root root 242896 Feb 20 03:07 trivial-rewrite
-rwxr-xr-x 1 root root 230280 Feb 20 03:07 verify
-rwxr-xr-x 1 root root 275464 Feb 20 03:07 virtual

You can check /etc/php.ini for the current safe mode settings:

; Safe Mode
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode
safe_mode = Off

Attribution
Source : Link , Question Author : Hydra IO , Answer Author : crashmaxed

Leave a Comment