From owner-freebsd-questions@FreeBSD.ORG Wed Apr 11 23:56:51 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5D5EC106564A for ; Wed, 11 Apr 2012 23:56:51 +0000 (UTC) (envelope-from lordi@msdi.ca) Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by mx1.freebsd.org (Postfix) with ESMTP id 2EAA58FC14 for ; Wed, 11 Apr 2012 23:56:51 +0000 (UTC) MIME-version: 1.0 Received: from server01.msdi.local ([184.161.83.132]) by VL-VM-MR004.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0M2C00BLJAIQNB10@VL-VM-MR004.ip.videotron.ca> for freebsd-questions@freebsd.org; Wed, 11 Apr 2012 19:56:50 -0400 (EDT) Received: from SERVER01.msdi.local ([::1]) by server01.msdi.local ([::1]) with mapi id 14.02.0283.003; Wed, 11 Apr 2012 19:57:54 -0400 From: Ian Lord To: "'freebsd-questions@freebsd.org'" Thread-topic: Sendmail recommended permissions for apache/php server Thread-index: Ac0YPYZroDjcEr5HTNqPZobUXzbABQ== Date: Wed, 11 Apr 2012 23:57:51 +0000 Message-id: Accept-Language: en-US, fr-CA Content-language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: X-Originating-IP: [192.168.0.151] Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Sendmail recommended permissions for apache/php server X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2012 23:56:51 -0000 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