title: Node exec doesn't have permission to execute script
body: <p>Up until recently, it has worked fine, but when I tried to use it today, it did not work properly. It returns the following error: </p>
  
  <blockquote>
    <p>Error: Command failed: /bin/sh -c
    /home/pi/RPi-Computer-Power/RPi-Server/routes/../scripts/hash.js
    12345678 /bin/sh: 1:
    /home/pi/RPi-Computer-Power/RPi-Server/routes/../scripts/hash.js:
    Permission denied</p>
  </blockquote>
  
  <p>I am extremely confused because when I try to run the script from the command line, it works perfectly; <code>/home/pi/RPi-Computer-Power/RPi-Server/routes/../scripts/hash.js 12345</code> executes flawlessly.</p>
  
  <p>This is the code where I try to execute the script. (index.js)</p>
  
  <pre><code>exec(__dirname+"/../scripts/"+req.params.script+" "+req.body.params, function(err, stdout, stderr) {
          console.log("err: ",err,"stdout: ",stdout,"stderr: ",stderr);
          if(err){
            res.send("&lt;a href='/'&gt;&lt; Back&lt;/a&gt; &lt;b&gt;Program Error:&lt;/b&gt; "+err.toString());
            return;
          }
          //res.send("&lt;a href='/'&gt;&lt; Back&lt;/a&gt; &lt;b&gt;Program Output:&lt;/b&gt; &lt;div style='white-space:pre-line&gt;'"+stdout+stderr+"&lt;/div&gt;");
          res.render("programOutput", {output: stdout});
        });
  </code></pre>
  
  <p>If anyone has any help, thank you in advance.
  Neil</p>