Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hey monks,

I am currently using the Cache::FileCache.pm model to do my caching. I am having problems when running it from the web, it doesnt seem to be writing to the cache which is using the default (/tmp/FileCache). The permission to /tmp is:

drwxrwxrwt 4 root apache 8192 Jul 22 09:39 tmp

I tried altering the FileCache permissions muitliple ways making it world writable:

drwxrwxrwx 2 root apache 4.0k Jul 22 09:41 FileCache

When I run the scripts from the command line as root or a diffrent user it runs just fine. The webserver is running as user apache. Can anyone point me in a direction where I can start debugging?

Replies are listed 'Best First'.
Re: FileCache permission probs from Apache
by dga (Hermit) on Jul 22, 2003 at 17:17 UTC

    Have you tried making apache the owner of the file in question?

    Otherwise, it can never actually do certain file operations in a directory which has the sitcky bit set (the last t in the mode)

    Update: Also I would change the mode to something a bit less dangerous.

    #WARNING: non perl code follows! chown apache /tmp/FileCache chmod 700 /tmp/FileCache #End of non perl code

    More update: corrected file mode as noticed by sgifford that the FileCache is a directory not a file

      I've never used FileCache, but from the OP's question it looks like it's a directory. If it is, you almost certainly want mode 0700, not 0600. Only giving read and write, but not execute, makes it impossible to use anything in that directory:
      $ mkdir t100
      $ chmod 600 t100
      $ ls -ld t100
      drw-------    2 sgifford sgifford     1024 Jul 22 13:41 t100
      $ cd t100
      bash: cd: t100: Permission denied
      echo 'hi' >t100/test
      bash: t100/test: Permission denied
      $ cat t100/test
      cat: t100/test: Permission denied