title: Tomcat sh script permission
body: <p>I'm using Tomcat7 and i tried to launch sh script from tomcat. My sh script need to create a new file and write things in. If i launch my script like ./test.sh it's work perfectly but if i use tomcat for launch that script i go an error of permission denied during the script execution, it doesn't have the permission to write. 
  This is my java code : </p>
  
  <pre><code>        String[] fixCmd = new String[] { path };
      Process start = Runtime.getRuntime().exec(fixCmd);
  
      // monitor standard error to find out what's wrong
      BufferedReader r = new BufferedReader(new InputStreamReader(start.getErrorStream()));
      String line = null;
      while ((line = r.readLine()) != null) {
          System.out.println(line);
      }
  </code></pre>
  
  <p>and my shellScript : </p>
  
  <pre><code>echo test &gt;&gt; test.txt
  </code></pre>
  
  <p>I tried to use ProcessBuilder but it didn't worked too. </p>
  
  <p>I tried to change the permission of the folder with all the solution i founds and nothing worked. When exec Tomcat used to be launching script as root so he do have all the permission required. I gived all the permission on folder to tomcat7 user in case but nothing changed. I have some other java scripts which are creating and writing file on the server so i already managed to change the right for let tomcat write things and it's work so i really don't know what is the problem of the script.</p>
  
  <p>Any ideas?</p>
  
  <p>Edit 1 : 
  The output of <code>ls -l ./test.sh</code> done that : </p>
  
  <pre><code>-rwxr-xr-x 1 tomcat7 tomcat7 165 nov.   2 16:12 ./test.sh
  </code></pre>
  
  <p>I'm logged as root and i red tomcat is considered as root too.</p>
  
  <p>Edit 2 Problem Solved : 
  A specialist explained me that my problem is a security problem, as tomcat is a web server it's a security to not let it have permission on sh script for write. So i changed my approach of the problem and i will read the sh script output in java and write my file from jave.</p>