| 
                         
 
- Create the user 'tomcat' and add this user to the tomcat group we created above.
 
<div class="dp-highlighter"> 
<div class="bar"> 
<div class="tools"> 
<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">view plain<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">copy to clipboard<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">print<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">?
 
 
- [root@blanche?~]#?useradd?-s?/bin/bash?-g?tomcat?tomcat??
 
 
 The above will create a home directory for the user tomcat in the default user home as /home/tomcat 
If we want the home directory to be elsewhere,we simply specify so using the -d switch.  
<div class="dp-highlighter"> 
<div class="bar"> 
<div class="tools"> 
<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">view plain<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">copy to clipboard<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">print<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">?
 
 The above will create the user tomcat's home directory as /usr/share/apache-tomcat-6.0.32/tomcat 
- Change ownership of the tomcat files to the user we created above:
 
<div class="dp-highlighter"> 
<div class="bar"> 
<div class="tools"> 
<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">view plain<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">copy to clipboard<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">print<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">?
 
 
 
 Note: it is possible to enhance our security still further by making 
certain files and directory read-only. This will not be covered in this 
post and care should be used when setting such permissions. 
- Adjust the start/stop service script we created above. In our new script,we need to su to the user tomcat:
 
<div class="dp-highlighter"> 
<div class="bar"> 
<div class="tools"> 
<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">view plain<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">copy to clipboard<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">print<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">?
 
 
- ??
 
- 
 - ??
 
- 
 - ?JAVA_HOME??
 
- 
 - ?PATH??
 
- 
 - ??
 
- 
 - start)??
 
- 
 - ;;???
 
- 
 - /bin/su?tomcat?$TOMCAT_HOME/shutdown.sh??
 
- 
 - restart)??
 
- 
 - /bin/su?tomcat?$TOMCAT_HOME/startup.sh??
 
- 
 - esac??????
 
- 
  
 
Step 6 (Optional): How to Run Tomcat on Port 80 as Non-Root User.
 Note: the following applies when you are running Tomcat in "stand alone" 
mode. That is,you are running Tomcat without Apache in front of it.  
To run services below port 1024 as a user other than root,you can add the following to your IP tables:  
<div class="dp-highlighter"> 
<div class="bar"> 
<div class="tools"> 
<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">view plain<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">copy to clipboard<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">print<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos">?
- [root@blanche?~]#?iptables?-t?nat?-A?PREROUTING?-p?udp?-m?udp?--dport?80?-j?REDIRECT?--to-ports?8080????
 
 
 Learn More About Apache Tomcat                         (编辑:泰州站长网) 
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! 
                     |