procmail
[Top] [All Lists]

Re: Permissions question

1998-09-29 12:04:14
Bryan Albright asked.

| I can get the file written to the
| directory just fine, but here's the rub:  procmail sets the
| permissions on all the files it creates to 600, but for web access, it
| needs to be 644.  How do I get procmail to change the permissions on
| just the file it is trying to create in the web-readable directory?

UMASK=133

in your .procmailrc just before the recipe that saves to the web directory.

Then remember to change it back to 177 before you save to any of your
personal folders.

| Here's the relevant sections from my .procmailrc file:
| 
| DATE_YYMM=${DATE_YYMM:-`/bin/date +%y%m`}
| 
| :0:

A local lockfile on a brace-opening recipe that doesn't fork a clone is
meaningless.  That's why you got the "extraneous local lockfile" error.
You need the second colon not there but rather ...

| *^Subject:.*Expired mail on tcsn
| {

... here:

|       :0c
|       /usr/local/www/data/expiry/tcsn/$DATE_YYMM.txt
|       :0
|       | "/bin/chmod +r /usr/local/www/data/expiry/tcsn/$DATE_YYMM.txt"
| }

#1: You needn't fork chmod.  Changing UMASK can take care of it.
#2: chmod won't read the text of the message, so without the `i' flag
    procmail will give a write error.
#3: Putting the whole command in quotes will tell procmail that it's the
    very long name of a single command with no positional parameters.
#4: Many versions of chmod won't violate the umask if you use "+r" or "+x"
    without specificying who gets those additional permissions: it will
    not assume "all" but "all except as forbidden by the current umask."
    To get around that, you need to say a+r or a+x or whatever.

The error message you got was because of #3.

Anyhow, let's try again:

 saveumask=$UMASK
 UMASK=133
 :0:
 *^Subject:.*Expired mail on tcsn
 /usr/local/www/data/expiry/tcsn/${DATE_YYMM-`/bin/date +'%y%m'`}.txt

 UMASK=$saveumask

Last question: why isn't /bin in your rcfile's $PATH?  You should be able
to refer to date and chmod by just their basenames.

<Prev in Thread] Current Thread [Next in Thread>