Wednesday, March 4, 2015

Run Tomcat 6/7 As tomcat Or Any Other User

                                      The default user and group are configured in /etc/default/tomcat.The file is format is show below
# Run Tomcat as this user ID. Not setting this or leaving it blank will use the
# default of tomcat7.
TOMCAT7_USER=tomcat7
# Run Tomcat as this group ID. Not setting this or leaving it blank will use
# the default of tomcat7.
TOMCAT7_GROUP=tomcat7
For Changing User Default User And Group In Tomcat:-
  1. Stop the tomcat service
  2. Editing the file /etc/default/tomcat7.Change the user and group in thi file
              (Add new user name instead of tomcat7)
  1. Change ownership of the folder /var/log/tomcat7 and /var/lib/tomcat7/webapps
            and all of it's files.
sudo chown -R newuser:newgroup /var/log/tomcat7
sudo chown -R newuser:newgroup /var/lib/tomcat7/webapps
sudo chown -R newuser:newgroup /var/log/tomcat7
     4. Optional :- Change ownership of the working folder
sudo chown newuser:newgroup /var/cache/tomcat7
sudo chown -R newuser:newgroup /var/cache/tomcat7/Catalina
     5. Make config files readable. Here you have two options:
Either add you new user to the tomcat7 group by:
sudo usermod -a -G tomcat7 newuser
          OR  change ownership of the config files:
sudo chown -R :newgroup /var/lib/tomcat7/conf/*
     6. Restarted the Server and Started the tomcat service

No comments:

Post a Comment

bloggerwidgets