0

I installed my Tomcat as root user in Linux for testing purpose and It's working fine. I would like to change the user for security purpose, So that owner of log files and other files will be created with new user. How can I do this. Please help me.

Thanks

2 Answers 2

2

Tomcat is normally running as root. For security reasons, it is always best to run services only with the minimum privileges that are necessary. Here I have mentioned only those for the Tomcat installation from the source file.

You can modify the Tomcat owner from root as follows:

  1. Create a group and user for Tomcat.
  2. Change ownership of the Tomcat installation files recursively so as to grant them to the user you have just created.
2
  • Can you please help me how to change ownership of the tomcat installation files to user for tomcat? Commented Mar 8, 2012 at 8:35
  • 1
    I think you are missing the actual part that changes the user that runs Tomcat. It is not useful at all to change ownership of Tomcat files if in the end you run it as a root user. Commented Sep 29, 2017 at 7:35
2

I know this is an old post but I just ran across it looking for the same thing and I don't think the answer is exactly right. This is what I found, change /etc/rc.d/init.d/tomcat7:

# from this:
/apps/apache-tomcat-7.0.37/bin/startup.sh

# to this:
su -c "/apps/apache-tomcat-7.0.37/bin/startup.sh start" tomcat

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .