Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

a lots of (Permission denied) in catalina.out

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.

like image 453
Mohammad Ali Akbari Avatar asked Jan 12 '11 17:01

Mohammad Ali Akbari


People also ask

Can you delete the Catalina out?

If you stop tomcat, you can delete all files without any problems. Without stopping, you can remove everything except catalina. out. After stopping the tomcat, you can clear out the contents under Logs folder of tomcat directory.

Where can I find Tomcat logs?

By default, the Tomcat HTTP Access Logs are stored in the dotserver/tomcat-X.x/logs/ folder within the dotCMS distribution, and the files are named dotcms_access. YYYY-MM-DD. log, where the YYYY-MM-DD in the file name is replaced by the date of the log file.

What is Tomcat JULI?

The internal logging for Apache Tomcat uses JULI, a packaged renamed fork of Apache Commons Logging that is hard-coded to use the java. util. logging framework. This ensures that Tomcat's internal logging and any web application logging will remain independent, even if a web application uses Apache Commons Logging.


2 Answers

$ 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.

like image 182
thecarpy Avatar answered Sep 19 '22 16:09

thecarpy


Can't vouch for the security of doing so, but

$ cd /usr/local/tomcat/ #or /usr/shared/tomcat6, whatever your $TOMCAT_BASE dir
$ chown -R tomcat6 webapps temp logs work conf
$ chmod -R 777 webapps temp logs work conf

works a treat for these situations.

My tomcat install was borked with permission errors, but throwing open the gates thusly fixed everything.

like image 31
Noel Avatar answered Sep 17 '22 16:09

Noel