Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using Tomcat Server. I woiuld 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.

share|improve this question

migrated from stackoverflow.com Jan 11 '12 at 9:59

This question came from our site for professional and enthusiast programmers.

    
Isn't this expected behavior for auto-deploy? –  Tom O'Connor Jan 11 '12 at 10:04
1  
Where is the question? –  Bart De Vos Jan 11 '12 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?

share|improve this answer
    
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!! –  amir2 taghvaei Jan 20 '12 at 5:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.