Unable to start tomcat as a different user

Keywords: Tomcat - Amazon Web Services - How to - Permissions
Description:
Due to some program limitations, I need to start tomcat as user bitnami and not as tomcat (Numerous external dependencies). Is there any way to do this? I have tried adding su bitnami -c ‘/opt/bitnami/apache-tomcat/catalina.sh start’. Tomcat does start (as evidenced by a ps-ef command), but doesnt serve pages. Even the tomcat default page doesnt load. Strangely this problem vanishes when I reboot the machine, log in as user bitnami and start tomcat using /opt/bitnami/apache-tomcat/catalina.sh start. Any ideas?

Hi @vijayrv,

If your are running into a permissions issue, I suggest you look for a good permissions configuration to try to avoid using the bitnami user to run tomcat.

In case there is not any other way to solve that, please follow these steps:

  • Stop tomcat
sudo /opt/bitnami/ctlscript.sh stop tomcat
  • Edit the /opt/bitnami/apache-tomcat/scripts/ctl.sh file and substitute all the “sudo tomcat” strings with “sudo bitnami”

  • Modify the permissions configuration:

cd /opt/bitnami/apache-tomcat/
sudo chown bitnami:bitnami -R conf/ logs/ temp/ webapps/ work/
  • Start Tomcat again
sudo /opt/bitnami/ctlscript.sh start tomcat
ps aux | grep tomcat

Thanks Jota. This works!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.