You are kidding right? Did you even try this from a test class?
-- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx ----- Original Message ----- From: "Christian Riedel" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 26, 2004 4:20 AM Subject: Is struts interfering with Runtime.exec() calls? > Hi all, > > some days ago I posted a problem about not being able to do a chmod on > the local file system from withing my webapp via a Runtime.exec() call. > To achieve this I tried the following call: > > > "/bin/chmod 660 /home/sarek/test/testfile" > > wich did not show any effect. Nor do most of the other calls I tried > which only had other permissions to be set. > > Here is a list of my attempts and their results: > > new perm before after > ------------------------------------------ > g+rw -rw------- -rw------- > u=rw,g=rw -rw------- -rw------- > 0660 -rw------- -rw------- > 0770 -rw------- -rw------- > 770 -rw------- -rw------- > 777 -rw------- -rw------- > 664 -rw------- -rw------- > > but most suprisingly: > > 064 -rw------- ----rw-r-- > > Now the problem is that I need to set the file's permission to > -rw-rw---- which I have not managed to do so far :-( > > I thought there was a problem with tomcat and and security issues that > prevents me from doing such things. So I just tried a small test-jsp to > see if this was really the case: > > > <html> > > <head> > > <title>Page to test java.lang.Runtime calls for chmod</title> > > <head> > > <body> > > <% > > try { > > String chmod = "/bin/chmod 660 /home/sarek/test/testfile"; > > Runtime run = Runtime.getRuntime(); > > out.println("- got Runtime<br>"); > > Process p = run.exec(chmod); > > out.println("- executed: "+chmod+"<br>"); > > p.waitFor(); > > out.println("- Process ended with exit code "+p.exitValue()+"<br>"); > > } > > catch (Exception e){ > > out.println("<br><font color='red'><strong>- caught exception: "+e.getMessage()+"</strong></font><br>"); > > } > > %> > > </body> > > </html> > > With the result that any permissions I tried to set with this page are > set just as I want them to. So it does not seem that tomcat is the problem. > > Now my actual question: > > Can it be that struts - because I actually want to call the chmod > command from within a struts based application - is interfering with my > attempts to do this Runtime call? > > I have no idea why all other attempts work but not when doing it from > within the application itself. We don't have any security manager set > and the testfile I pasted before works fine on the same tomcat instance. > > Can anyone help me? > > TIA > > Christian > -- > To reply to this posting directly use the following address and > remove the 'NO-SPAM' part: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]