用普通用户启动tomcat,话不多说,看记录。
[root@web02 ~]# useradd tomcat
[root@web02 ~]# passwd tomcat
Changing password for user tomcat.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@web02 ~]# /opt/apache-tomcat-6.0.29/bin/shutdown.sh
Using CATALINA_BASE: /opt/apache-tomcat-6.0.29
Using CATALINA_HOME: /opt/apache-tomcat-6.0.29
Using CATALINA_TMPDIR: /opt/apache-tomcat-6.0.29/temp
Using JRE_HOME: /usr/java/jdk1.6.0_18/jre
Using CLASSPATH: /opt/apache-tomcat-6.0.29/bin/bootstrap.jar
[root@web02 ~]# cd /opt/apache-tomcat-6.0.29/
[root@web02 apache-tomcat-6.0.29]# ll
总计 96
drwxr-xr-x 2 root root 4096 07-28 13:18 bin
drwxr-xr-x 3 root root 4096 08-06 09:17 conf
drwxr-xr-x 2 root root 4096 07-28 13:18 lib
-rw-r--r-- 1 root root 37950 07-19 21:01 LICENSE
drwxr-xr-x 2 root root 4096 08-06 09:17 logs
-rw-r--r-- 1 root root 557 07-19 21:01 NOTICE
-rw-r--r-- 1 root root 8669 07-19 20:59 RELEASE-NOTES
-rw-r--r-- 1 root root 6670 07-19 21:01 RUNNING.txt
drwxr-xr-x 2 root root 4096 07-28 13:18 temp
drwxr-xr-x 7 root root 4096 07-19 20:59 webapps
drwxr-xr-x 3 root root 4096 08-06 09:17 work
drwxrwxrwx 3 tomcat root 4096 08-05 17:19 ztcrecords
[root@web02 apache-tomcat-6.0.29]# chown -R tomcat bin
[root@web02 apache-tomcat-6.0.29]# chown -R tomcat logs
[root@web02 apache-tomcat-6.0.29]# chown -R tomcat conf
[root@web02 apache-tomcat-6.0.29]# chmod +u bin
[root@web02 apache-tomcat-6.0.29]# chmod +u conf
[root@web02 apache-tomcat-6.0.29]# chmod u+x logs
[root@web02 apache-tomcat-6.0.29]# su - tomcat
[tomcat@web02 ~]$ /opt/apache-tomcat-6.0.29/bin/startup.sh
Using CATALINA_BASE: /opt/apache-tomcat-6.0.29
Using CATALINA_HOME: /opt/apache-tomcat-6.0.29
Using CATALINA_TMPDIR: /opt/apache-tomcat-6.0.29/temp
Using JRE_HOME: /usr/java/jdk1.6.0_18/jre
Using CLASSPATH: /opt/apache-tomcat-6.0.29/bin/bootstrap.jar
[tomcat@web02 ~]$ netstat -pltn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 6090/java
tcp 0 0 :::8009 :::* LISTEN 6090/java
tcp 0 0 :::8080 :::* LISTEN 6090/java
tcp 0 0 :::22 :::* LISTEN -
[tomcat@web02 ~]$ /opt/apache-tomcat-6.0.29/bin/shutdown.sh
Using CATALINA_BASE: /opt/apache-tomcat-6.0.29
Using CATALINA_HOME: /opt/apache-tomcat-6.0.29
Using CATALINA_TMPDIR: /opt/apache-tomcat-6.0.29/temp
Using JRE_HOME: /usr/java/jdk1.6.0_18/jre
Using CLASSPATH: /opt/apache-tomcat-6.0.29/bin/bootstrap.jar
[tomcat@web02 ~]$ netstat -pltn
(No info could be read for "-p": geteuid()=500 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 :::22 :::* LISTEN -
开启和关闭都ok。