a lots of (Permission denied) in catalina.out

Mohammad Ali Akbari picture Mohammad Ali Akbari · Jan 12, 2011 · Viewed 43k times · Source

How can i install Apache web server and Apache tomcat to avoid get errors like this:

java.io.FileNotFoundException: /usr/local/apache-tomcat-7.0.5/work/Catalina/localhost/_/SESSIONS.ser (Permission denied)

in /usr/local/apache-tomcat-7.0.5/logs/catalina.out

I think I should do something for Apache user, because when I chmod 777 -R ./ on tomcat folder all errors disappear.

Answer

thecarpy picture thecarpy · Sep 18, 2013
$ chmod -R 777 webapps temp logs work conf

Is VERY dangerous, do not do it, did I write "not do it" ? DO NOT DO IT! Guess where your tomcat-users.xml is with your usernames and plain-text passwords ?

Giving world read-write-execute anywhere on UNIX except /tmp (and even then, in prod, NEVER do that either) is plain stupid. And, it makes your first line, chown -R tomcat6 completely useless.

make sure tomcat runs as tomcat7 (it is tomcat6 for tomcat 6) and simply do:

$ cd $TOMCAT_BASE
$ chown -R tomcat7:tomcat7 webapps temp logs work conf
$ chmod -R 660 webapps temp logs work conf

[EDIT] changed 770 to 660 following comment, because the files in question need not be executed.

If you want to be able to read, write, or execute stuff there, add yourself to the tomcat7 group.