Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I had an issue where the permissions of /var/lib/php/session got overwritten so I could no longer created session variables in PHP.

I think the same thing is happening with my mail function. Where is the mail function located in a linux server so that I can chmod it?


Edit

Some additional information:

$ "This is a test" | mail -s "Testing 123" team_pegasus@rayhawk.com
-bash: This is a test: command not found
Null message body; hope that's ok
postdrop: warning: mail_queue_enter: create file maildrop/111989.3781: Permission denied
postdrop: warning: mail_queue_enter: create file maildrop/112524.3781: Permission denied
postdrop: warning: mail_queue_enter: create file maildrop/113649.3781: Permission denied
postdrop: warning: mail_queue_enter: create file maildrop/114574.3781: Permission denied
postdrop: warning: mail_queue_enter: create file maildrop/115551.3781: Permission denied

chmod: changing permissions of `/usr/sbin/sendmail.postfix': Operation not permitted

chmod: changing permissions of `/usr/sbin/sendmail': Operation not permitted
share|improve this question

3 Answers 3

up vote 2 down vote accepted

The mail() function does many different things depending on how you configure it. You could be pointing it at an external SMTP server for example, if that is the case then there is nothing on your local system to touch.

If you haven't changed it from the default then you are running some mail transfer agent on your system, but there are a large number of possibilities. Are you actually running sendmail, or are you just running some tool which has a sendmail compatible binary? i believe Postfix is the default MTA on Centos. Unfortunately I am not sure what the spool folders are named and what the default permissions should be.

If nobody else answers with the specifics, then I suggest you quickly setup a virtual machine similar to your main system and simply compare and then repair the permissions.

From a command line shell you could also test things. Just run a command like echo 'test' | sendmail youraddress@example.org.

share|improve this answer
    
I've tried some debugging stuff and added the results to my answer. –  Steve Robbins Sep 20 '11 at 23:39

Check the sendmail_path variable set in your php.ini (by default: /usr/sbin/sendmail ) , which will be used by the php mail() function.

share|improve this answer

# /etc/postfix/post-install set-permissions

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.