Tomcat startup user and permission settings under linux

Tomcat installation: decompress it, there are a lot of online tutorials.
Note that the environment variables are configured when installing JDK: JAVA_HOME=/xxx/yyy/xxx
 
If you run tomcat directly as root, of course you don't need to do any settings, but the root user. . . You know, it's dangerous. Therefore, the user tomadm needs to be established, the group is also tomadm , and tomcat uses this user to start.

 

1. Set the groups of the conf, logs, temp, and work directories in the tomcat directory to tomadm (chgrp webadmin xxx);

 

2. Set the setenv.sh file (if there is no such file in the bin directory, create it), and write CATALINA_PID=$CATALINA_HOME/logs/CATALINA_PID in it; this setting is to let Tomcat start, generate the CATALINA_PID file in the logs directory, Store the process code of the current tomcat runtime, so that the process of tomcat can be terminated by killing the process. (Solve the problem that sometimes tomcat cannot exit)

 

3. Add the group permissions of the logs, temp, and work directories to write (chmod g+w xxx). These directories are all places to be written when tomcat is running. Among them, CATALINA_PID, catalina.out, and various log files should be written under logs; various temporary files should be written under temp; various jsp compilation files should be generated under work.

 

4. Set the log log directory (such as wwwroot/dbk/WEB-INF/_logs) under the web application server directory to be run as tomadm , and then give the group write permission.


5. The upload directory of the application (such as wwwroot/xxx/data), set the group to tomadm , and give the group write permission.

 


Note that if you have started tomcat with the root user before, a file whose owner and group are both root will be generated in the log file or temporary file. At this time, some files will be overwritten, but it may occur that the webadmin user does not have the right to overwrite root. The condition of the file caused an error. At this point, you need to delete the previously generated files.

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327011971&siteId=291194637