Postfix - Mail forwarding settings - write to file

3 posts / 0 new
Last post
#1 Sun, 02/04/2007 - 05:16
Dirk

Postfix - Mail forwarding settings - write to file

Hi, I try to setup postfix to write to a certain file (for later processing). I don't get the rights setup correctly. I get a mail dalivery error like this

<foto.someuser@subdomain.somedomain.tld> (expanded from[foto@somedomain.tld>): cannot append message to destination file /home/someuser/test: cannot open file: Permission denied

What are the correct settings for the file "test". Who should be owner? I tried with someuser:someusersgroup (644) and with foto.someuser:someusersgroup (644)... Both didn't work. I also tried with adding postfix user to someusersgroup. Also didn't work.

Any ideas?

regards dirk

Sun, 02/04/2007 - 14:07
Joe
Joe's picture

Hey Dirk,

You'll probably want to put the file into the users home directory rather than the domain home. I think that'd be /home/someuser/homes/foto.someuser in this case. I'm guessing that someuser is the owner account of somedomain?

That said, having the test file pre-existing and owned by foto.someuser probably ought to work...It's actually procmail doing the delivery in our default configuration, which becomes the user in question for delivery. But that makes me think your second example (owned by foto.someuser and mode 644) ought to work. But, if the file doesn't exist, then it won't work because foto won't have permissions to write to the domain's home directory.

Login as the foto user and see if it can write to that file...that'll at least make sure the file (and the directory it is in) are accessible and writable by that user.

Also worth mentioning: Postfix is not used for delivery (by default) and so has no relation to this problem. And, if it were doing the delivery, it doesn't respect secondary groups, and so would ignore being in the someuser group, anyway. This is one of the only things I really don't like about Postfix...but most MTAs don't do secondary groups, so there must be some really good reason for it that I don't comprehend.

--

Check out the forum guidelines!

Sat, 03/10/2007 - 13:28
Dirk

Hi thanks,
maybe I should explain what I want to do, maybe I'm thinking the wrong way.

I want to write emails for foto@mydomain into a file, let a script (?) / php (?) run over this file, extract the picture in it and resend it somewhere else.

From my understanding, PHP can only handle work in domain directories, or also in other ones?

Is PHP the right language to do that, or should it be some other script?

regards Dirk

Topic locked