1
votes

I am trying to deploy a .war file using Tomcat8, Apache, and Ubuntu 15.04. When I click "Select WAR file to upload" in the /manager section of tomcat I get the following error:

FAIL - Deploy Upload Failed, Exception: java.io.FileNotFoundException: /opt/tomcat/webapps/musicStore.war (Permission denied)

How would I fix this?

1
chmod to give permissions in full on that folder - Kon
Just chmod 777 everything? - CSLearner
Open everything to the world? Well - your choice. I'd not do it. Tomcat runs as a specific user. It's ok to just give that user permissions to the directory. Or not use manager - rather copy the file there through the OS - Olaf Kock
I'm a newbie. How would I go about creating the specific user and then giving it permissions to deploy the WAR? - CSLearner
your /opt/tomcat/webapps directory belongs to someone (execute ls -l /opt/tomcat/webapps to see whom it belongs to). While tomcat is running, execute ps aux | grep catalina to see which user is running tomcat. You could chown thatuser /opt/tomcat/webapps. However, for production systems I'd strongly recommend to not have the manager application running and tomcat's own directory writeable to itself. It opens up quite a few attack vectors and is bad practice - Olaf Kock

1 Answers

3
votes

Converting comments to an answer, adding more information:

Your /opt/tomcat/webapps directory belongs to someone (execute ls -l /opt/tomcat/webapps to see whom it belongs to).

While tomcat is running, execute ps aux | grep catalina to see which user is running tomcat (depends on the way you start it - might be your own current user). You could chown <thatuser> /opt/tomcat/webapps. However, for production systems I'd strongly recommend to not have the manager application running and tomcat's own directory writeable to itself. It opens up quite a few attack vectors and is bad practice IMHO

If it's a local development system, comfort typically trumps security - and you might opt for keeping the manager app.

To mitigate the potential manager-app problems in production, at least limit access to known IP-Addresses, keep the user database well maintained (not in tomcat-users.xml with clear text passwords). However, on my production systems, tomcat can not write to its own webapps directory - thus hot deployment of applications through the manager app won't work anyways...