title: How to create a Child process as a specific user with Node?
body: <p>I want to use a child process to execute a Java file. The problem I do not want this code to only have read and write permissions in a specific folder. So I was thinking of executing the code as specific user. Is this possible with node?</p>
  
  <p>Here is the basic code I have:</p>
  
  <pre><code>var exec = require('child_process').exec, child;
  
  exec("javac user_script/test.java&amp;&amp;java -classpath user_script test", function (error, stdout, stderr) {
      console.log(stdout);
  });
  </code></pre>
  
  <p>I am working on a mac, but I can also run the code on ubuntu.</p>
  
  <p>By the way, I know that even if this can be done it will still have security issues if the file is written by a user. But this is not what I am asking for :)</p>