I'm using Tomcat Server. I would like the owner of the file cms.war to be the ftp user the tomcat user to be the owner of the cms/ folder.

When I uploaded cms.war it was automatically deployed in cms/ folder and when I deleted cms.war the cms/ folder was deleted.

  • Isn't this expected behavior for auto-deploy? Commented Jan 11, 2012 at 10:04
  • 1
    Where is the question? Commented Jan 11, 2012 at 10:06

1 Answer 1


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?

  • The real problem is: i used cpanel+tomcat . i extracted war file next upload on server . the owner folder is ftpuser . when the program want write to file , this error Occured: can not permission to write file . the permission of folder is 777 . tomcat user is member of that folder group . but tomcat can not write to file ???? . please help me!! Commented Jan 20, 2012 at 5:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .