Java – Tomcat does not parse War symbolic link

I have a development machine. I installed Tomcat before and just run it as the same user who is developing I will $Catalina_ The symbolic link in home / webapps is put into the directory of the War I build. Each time I update the tomcat, I follow the symbolic link and extract the new war No problem

But in preparation for moving it to the production machine, I created a new user with restricted permissions and set Tomcat to run as that user, just as you did for security reasons

Now Tomcat no longer follows symbolic links, even if I give its user ownership of the war file and set the permission to 777 I didn't see anything in Catalina Out or daily log about what happened

This is just one step of copying the test cycle of war, so it's not too critical, but I'm still curious about what happened

Permissions under webapps Directory:

drwxr-xr-x 3 tomcat tomcat  4096 Dec 11 14:34 webapps

Permissions for the directory I'm building:

drwxrwxr-x 11 tomcat   tomcat   4096 Dec 11 14:34 target

Permission generation of war file Maven:

-rw-rw-r-- 1 tomcat tomcat 16822856 Dec 11 14:34 [webapp].war

Permissions for symbolic links I create:

lrwxrwxrwx 1 tomcat tomcat 60 Dec 11 17:33 [webapp].war -> [webapp directory]/[webapp].war

Solution

I suspect that Tomcat users do not have traversal permissions on one of the nested folders containing real war files As you said, he has permission to use Tomcat folder, so he can start tomcat, and he can see the existence of symbolic links

Perhaps your build process creates a war file in a private folder, assuming that the user is in the home folder of glazius. Even if the file has the correct permissions, Tomcat users cannot read the file

You can easily use:

ls -Cf

Check the symbolic link color in your webapps folder: if it is red, the user cannot access the file. If it is blue, it should have no problem

If it is red, make sure that each folder of your war file has traversal (x) permission for another group If the path is / home / glacier / workspace / target / webapp War, execute the following command:

chmod o+x /home/glazius
chmod o+x /home/glazius/workspace
chmod o+x /home/glazius/workspace/target
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>