Sendmail recommended permissions for apache/php server

Ian Lord lordi at msdi.ca
Wed Apr 11 23:56:51 UTC 2012


Hi,

I am trying to use sendmail  to send emails from a php script (I tried phpmailer and mail function with the same result).

I always got messages like "Could not execute: /usr/sbin/sendmail"

Sendmail is World executable:
# ls -l /usr/sbin/sendmail
lrwxr-xr-x  1 root  wheel  21 Jan  3 02:57 /usr/sbin/sendmail -> /usr/sbin/mailwrapper

So I've checked into /var/log/messages and found this:
Apr 11 18:09:44 dev sendmail[38340]: NOQUEUE: SYSERR(www): can not chdir(/var/spool/clientmqueue/): Permission denied

I've checked permissions on the /var/spool/clientmqueue/ directory
# ls -al /var/spool/clientmqueue/
drwxrwx---  2 smmsp  smmsp   3 Apr 11 19:01 .

So I saw that only the user and group smmsp could write to this directory. I presumed the apache user should have access to it so I added "www" to the "smmsp" directory.

I then got a different error in /var/log/messages
Apr 11 19:38:40 dev sendmail[41170]: NOQUEUE: SYSERR(www): can not write to queue directory /var/spool/clientmqueue/ (RunAsGid=0, required=25): Permission denied

I found very old threads saying to change the group of apache to "smmsp" but I doubt it's a good idea.

Chmodding 777 the /var/spool/clientmqueue/ fixed the problem, I can now send emails, but I wonder if this is the way to fix the issue correctly.

Is that the official fix or did I missed some configuration somewhere ? Sending emails from php using mail or sendmail should be something working out of the box I guess, I doubt we're supposed to change permissions to make it work

Any help would be appreciated.

Regards

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ian Lord
MSD Informatique
143 Rue des Fauvettes
St-Colomban (Québec) J5K 0E2
Tél: (514) 776-MSDI              -> (514) 776-6734
Sans Frais: 1(877) 776-MSDI -> 1(877) 776-6734
http://www.msdi.ca<http://www.msdi.ca/>



More information about the freebsd-questions mailing list