You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kimberly Begley <ki...@gmail.com> on 2008/04/03 00:00:44 UTC

permissions to read/write files outside webapps directory?

Hi,
I've just deployed my webapp on the remote server (tomcat5 and red hat
linux) - everything is displaying properly but when the user uploads a file
for processing it is failing - looking in the log files it appears that
tomcat can't read or write files outside the webapps directory by these
error messages:

java.io.FileNotFoundException:
/home/kimberly/test/cases/85/85-settings.txt(Permission denied)

Permissions on this directory are readable by everyone and I thought tomcat
would be able to write/read  to the tomcat5/temp directory but that doesn't
appear to be happening either.

I want it to read 1000's of files from my home directory and when uploading
files to write them to the temp file in /usr/share/tomcat5/temp/test. This
works great on my local copy but isn't working on the remote server.

So from what I gather online I need to edit the catalina.policies file to
allow read/write access to the appropriate directories. Before I go messing
around with the policies file for the first time I wanted to double check
that this is appropriate as well as check the syntax.

// Example policy file entry

grant [signedBy <signer>,] [codeBase <code source>] {
  permission  <class>  [<name> [, <action list>]];
};


So syntax would be something like:
grant codeBase "file:${catalina.home}/temp" permission
java.io.FilePermission, "read,write";
grant codeBase "file:/home/kimberly/test/cases"
permission.java.io.FilePermission, "read";

And then do I just restart tomcat?
Please any advice would be greatly appreciated.
Thanks!