2012-03-14 1 views
3

/var/spool/clientmqueueのパーミッションを777に変更しない限り、sendmailがapache + phpから機能しなくなります。/var/spool/clientmqueueにのApache + PHPでメールを送信するパーミッションのエラー777

所有権は

drwxrwxrwx 2 smmsp mail 4096 Jul 19 11:50 clientmqueue 

私はsmmspユーザとApache用のユーザー・グループとめちゃめちゃてきました。 maillogには

id apache 
uid=48(apache) gid=48(apache) groups=48(apache),12(mail) 

id mail 
uid=12(mail) gid=12(mail) groups=12(mail),48(apache) 

SELinuxが無効になっている

getsebool httpd_can_sendmail 
getsebool: SELinux is disabled 

私は770

NOQUEUE: SYSERR(apache): can not write to queue directory 
/var/spool/clientmqueue/ (RunAsGid=48, required=12): Permission denied 

にフォルダのアクセス許可を設定すると、どんなメールが送信されませんし、私はPHPからエラーになるだろう。私は0777にフォルダを設定した場合

は、代わりに私がmaillogに

dangerous permissions=40776 on queue directory /var/spool/clientmqueue/ 

でこれになるだろう。しかし、PHPは罰金メールを送信します。

0770で動作させて、メールでグループに読み込んでもらえるのですか?私はエラーがapacheメインGID 48を取得していることを知っているが、それはまた、グループ12を共有します。

何か助けが素晴らしいだろう。

答えて

1

私はこの問題を今日も同じようにしていました(そして、答えを探していました)。

私は結局見つけたthis overview;そのリストから次のコマンドを実行すると、私のために問題を修正しました:

chmod 4555 /usr/sbin/sendmail 

これはおそらくApacheがメールユーザーとしてメールを送信できるように、sendmailのバイナリにsetuid special modeを設定します。

私はまだ最初にこの問題の原因をにとして非常に興味が(私はそれらの実際に必要な再起動のどちらか不明だが、ことを実行した後、Apacheとのsendmailデーモンの両方を再起動)しかし、場所...

1

この1つは私のためのトリックでした。私はUbuntuマシンでこれを打つ前に他のエラーがありました。他の誰かがその中に侵入した場合にそれを分かち合いましょう。私は得ていた NOQUEUE:SYSERR(www-データ):chdirできません(/ var/spool/mqueue-client /):アクセスが拒否されました。

usermod -a -G smmsp www-data 
chmod 770 /var/spool/mqueue-client  (don't use 775, it gives dangerous permission error in the log) 
service apache2 restart (this is required for the above to take effect) 
Now sending email gives a different error. 
- NOQUEUE: SYSERR(www-data): can not write to queue directory /var/spool/mqueue-client/ 
- chmod 4555 /usr/sbin/sendmail 
- Above command fixed the email issue. => didn't see any error in the mail.log this time.