How to allow writing to domains 'httpdocs' folder for a Tomcat application?

Created:

2016-11-16 13:14:25 UTC

Modified:

2017-04-24 11:42:07 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to allow writing to domains 'httpdocs' folder for a Tomcat application?

Applicable to:

  • Plesk 12.5 for Linux

Symptoms

Tomcat Web Application needs to write into domains' httpdocs folder, but gets permission denied exception.

Resolution

  1. Allow read/write operation on the domain's httpdocs folder for Tomcat application by editing $CATALINA_HOME/catalina.policy file. For the app application and the example.com domain it will be:

    grant codeBase "jar:file:$\\{catalina.home\\}/work/PSA/example.com/app/-" \\{
        permission java.io.FilePermission "/var/www/vhosts/example.com/httpdocs" "read,write";
    \\}
  2. Restart Tomcat

  3. Add the system user, that is used by Tomcat service, into psaserv group. The username can be found in the main Tomcat configuration file:

    # grep TOMCAT_USER  /etc/tomcat*/tomcat*.conf
    TOMCAT_USER="tomcat"
    # usermod  -G psaserv tomcat
  4. Allow psaserv group to write to domains' httpdocs directory:

    # chmod 770 /var/www/vhosts/example.com/httpdocs

Note for Plesk 12.5:

  • Tomcat user:

    # grep TOMCAT7_USER /etc/default/tomcat7
    TOMCAT7_USER=tomcat7
  • catalina.policy file is /etc/tomcat7/policy.d/03catalina.policy

Have more questions? Submit a request
Please sign in to leave a comment.