I have created a tomcat.sh file so that I can start and stop tomcat via the terminal. I placed the file inside the /bin folder and performed chmod u+x on it to make it executable.

But then when I try the command tomcat start it just gives me the following:

Using CATALINA_BASE:   /usr/share/tomcat7
Using CATALINA_HOME:   /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME:        /usr/lib/jvm/java-6-sun-
Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
touch: cannot touch '/usr/share/tomcat7/logs/catalina.out': Permission denied
/usr/share/tomcat7/bin/catalina.sh: 538: cannot create /usr/share/tomcat7/logs/catalina.out: Permission denied

I'm a new to Linux. Please help me set up proper permissions for this. If not, then maybe I'll just move my tomcat folder elsewhere.

  • First of all, you should place the file in /usr/local/bin rather than /bin. Also, if the file is called tomcat.sh, you won't really execute it when you call tomcat, since the name is different. What's the content of your tomcat.sh file? Have you tried just running tomcat with sudo tomcat start? – slhck Jan 27 '12 at 9:34

Use: mkdir -p /usr/share/tomcat7/logs/


The simple answer to this is probably that you need to start the Tomcat service as root. Try sudo tomcat start instead (assuming that tomcat start is correct); that will run the starter process as root.

It's either that, or you aren't executing what you think you are. Remember that in Linux, you must give the full name of the file you want to execute; tomcat and tomcat.sh are distinctly different. This is because unlike on Windows, file extensions in Linux (and other Unixes) are essentially devoid of meaning to the OS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.