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'm trying to pipe from postfix to a command. According to Postfix logs it worked, but when I check the command it didn't. This is a fresh postfix install. This is my alias file:

# See man 5 aliases for format
postmaster:    root
support:  "| /usr/bin/php -q /var/www/pipe/pipe.php"

I run sendmail support@mydomain.com then type it and then on a separate line type . and it goes. I check the postfix log /var/log/mail.log and this is what it states:

Nov  2 15:32:33 server3 postfix/local[13284]: 42C429E0B5: to=<support@mydomain.com>, relay=local, delay=156, delays=156/0.01/0/0.05, dsn=2.0.0, status=sent (delivered to command:  /usr/bin/php -q /var/www/pipe/pipe.php)

So according to that it worked, but it doesn't. If I run echo 'text' | /usr/bin/php -q /var/www/pipe/pipe.php it does work just fine.

Any ideas what I did wrong?

I know piping is working, I originally checked it by running that command above WITHOUT the quotes, so just support: | /usr/bin/php -q /var/www/pipe/pipe.php What it did there was append my email header and all to the file pipe.php. So I know postfix was piping it, but when I put in the quotes it says it's going but it's not according to my script.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

I was only missing one line in my /etc/postfix/main.cf file.

default_privs = www-data

Which is weird since I tried running as 777 the file, so in theory it should have worked. Oh well it works this way now. So in short set privs of the owner of the file since Postfix defaults to user nobody.

share|improve this answer
    
Since you answered your own question, why not accept the answer too? –  adamo Nov 3 '12 at 7:33
    
I have to wait two days after posting my own answer to accept my own as the answer :( –  jfreak53 Nov 3 '12 at 14:02
add comment

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.