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
<firstname.lastname@example.org> (expanded from[email@example.com>): cannot
append message to destination file /home/someuser/test: cannot open file:
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.
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.
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?