Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Apr 2012 23:57:51 +0000
From:      Ian Lord <lordi@msdi.ca>
To:        "'freebsd-questions@freebsd.org'" <freebsd-questions@freebsd.org>
Subject:   Sendmail recommended permissions for apache/php server
Message-ID:  <AC28A3ECE8FFEA4CAE20B2B79FDB8F709B6DDB@server01.msdi.local>

next in thread | raw e-mail | index | archive | help
Hi,

I am trying to use sendmail  to send emails from a php script (I tried phpm=
ailer 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(/v=
ar/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=3D0, required=3D25): Pe=
rmission denied

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

Chmodding 777 the /var/spool/clientmqueue/ fixed the problem, I can now sen=
d 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 ? Sen=
ding 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 i=
t work

Any help would be appreciated.

Regards

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AC28A3ECE8FFEA4CAE20B2B79FDB8F709B6DDB>