Ubuntu 18.04, running postfix and procmail I have a .procmailrc and a .forward and all that. I configured procmail to log to a specific file, and the only way I can get it to work is by setting that file to be world readable and writable. Obviously this is no good. How do I determine what user account procmail is using to access files so I can lock it down to that account? (root:root and 644 didnt work....)
I have the same problem with a file written by a python script which procmail recipe calls - the only way to get it to work so far is to make the file 777. Again, I dont know how to figure out what account is trying to access this file when the python script runs.
ETA: The .procmailrc is as follows:
# Set to yes when debugging
VERBOSE=yes
# Default INBOX
INBOX=$MAIL
# Directory for storing procmail-related files
PMDIR=$HOME/procmail
# Uncomment the following line to get logging
LOGFILE=/var/log/procmail/pmlog
:0wc:
| /usr/bin/python /home/[MyUsername]/scripts/mailproc.py
mailproc.py is a simple python script which postprocesses the email message for a specific purpose. I added a call to "whoami" in the py file and discovered that the py is running under the user who owns the procmailrc file.
But I still cant figure out who should own the procmail log file. Having it root:root and 644 wont work.
There is no sane way for a normal user to write to the system's log files.
What you might be able to do as a partial workaround is to not set a
LOGFILE
at all. Procmail will still write log entries to standard error, and so perhaps that output will be sent to the Postfix log file (or perhaps you can add an explicit redirection to the specified location where you runprocmail
).A much simpler and obvious solution is to have the user's
.procmailrc
write the log file to their home directory, where obviously they routinely have write access.