I’m using Tomcat Server. I would like the owner of the file
cms.war
to be theftp
user thetomcat
user to be the owner of thecms/
folder.When I uploaded
cms.war
it was automatically deployed incms/
folder and when I deletedcms.war
thecms/
folder was deleted.
Answer
The chown
command can help you reassign the ownership of a file or folder. With Tomcat and autodeployment, the WAR file must be readable by the Tomcat user so that it can read and unpack it for deployment.
To change the owner of cms.war:
chown ftp cms.war
Note: This command is likely to require root privileges/sudo
To ensure that cms.war is readable by Tomcat:
chmod 744 cms.war
Note: This gives read, write, and execute privileges to the owner, and read privileges only to the group and others.
As for the Tomcat removing the the deployed cms/ folder when the WAR is deleted, that seems entirely reasonable behaviour for the autodeploy feature, as it allows you to easily add and remove web apps:
- When you add the WAR, Tomcat reads it and deploys it to a directory of the same name
- When you remove the WAR, Tomcat undeploys it by deleting the directory
What exactly is the problem with that?
Attribution
Source : Link , Question Author : amir2 taghvaei , Answer Author : chrisbunney