Search code examples
tomcatfile-permissionstomcat8

Tomcat 8 change catalina.out permissions to be readable by all


The catalina.out file is getting created with "-rw-r-----" permissions (i.e 640 permissions). I want to give read permission to "others" too but that is not happening.

Tried setting umask as 022 in setenv.sh and in other places but this did not help.

Also tried touching files manually using the same tomcat user and they are getting created with "-rw-rw-r--" (i.e 664 permissions). So not sure why tomcat is behaving this way.

Also don't want to manually change the permissions using chmod etc as this is a hack and needs to be repeated in case of file deletion.


Solution

  • Solved the problem by adding an environment variable called "UMASK" (all capitals) as follows. This env variable should be set before invoking catalina.sh.

    export UMASK="0022"
    

    To give some background, the catalina.sh script looks for UMASK environment variable (Optional). If this variable is not present in the environment, Tomcat uses default UMASK of 0027, else it uses the override value for umask.