I have a server running Tomcat, and I need Tomcat to create a file in a particular folder.
Tomcat (technically a Java app) runs as the user 'tomcat', as evidenced by top:
#top
1251 tomcat 20 0 7427m 2.3g 9624 S 3.0 30.0 856:04.62 java
Part of my Tomcat code is to create a new file 'foo.txt' in '/foo/'
The user 'tomcat' is a member of group 'work', as evidenced by groups:
#groups tomcat
tomcat : tomcat work
The folder '/foo/' has these permissions:
drwxrwxr-x 2 root work 4096 Oct 8 14:20 .
When Tomcat tries to create a file within that folder, he gets a 'permission denied' error.
HOWEVER, when I chown /foo/ to the tomcat user, it works fine.
SO, is Java somehow not able to utilize Group permissions?? Not likely, IMHO. What am I missing?
tomcat
? It sounds like it's not callinginitgroups()
, so the process doesn't get all its secondary groups enabled./foo
may be blocking Tomcat from writing to this directory via SELinux. You can runsealert
to see any pending alerts.