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 have a script inside the WEB-INF folder that the Java runs. When I deploy the WAR, there are no execute permissions (644 instead of 755). How do I set the permissions of files inside the WAR?

share|improve this question
    
BTW, I create the WAR on Windows and deploy it on Ubuntu. Does that make a difference? –  Kalisky May 8 '13 at 13:47

2 Answers 2

up vote 0 down vote accepted

In the webapps directory (or whatever directory you have the app deployed), just run a

chmod -R 2755 webapps

and you should be good.

share|improve this answer
    
But I want the WAR to be ready out of the box without having to set the permissions every time I deploy it –  Kalisky May 22 '13 at 8:21
    
If you are manually extracting you may need to update the umask for the user doing this. If using hot deploy, you should be ok once you set the permissions on the webapps folder. –  Schrute May 23 '13 at 0:46
    
Using hot deploy (simply copying the war to the webapps folder, and waiting for Tomcat to open it). So you mean change the permissions on the deployed folder, then when the next time Tomcat opens it, it won't change the permissions? –  Kalisky May 23 '13 at 6:46
    
Well I mean the parent folder, the one Tomcat is polling. –  Schrute May 26 '13 at 17:08
    
oh, now I get you... But this way I can't have other files with different permissions, they will all be with execution permissions... –  Kalisky May 27 '13 at 9:29

Since the scripts belong to the application, have it set the permissions upon initialization. For a servlet in the init method something like:

String [] command = {"/bin/chmod","+x",files_to_be_changed_permissions};
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec( command );
pr.waitFor();

allows the application to take care of setting permissions for its own files

share|improve this answer

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.