Can a
sudo node app.js
spawn/fork a
./myScript.sh
that uses only default user instead of sudo?
The script runs an application that must not be run from sudo(because CUDA can't find libnvrtc.so.10.0 for an application that the script calls) but Nodejs application must use sudo because it needs port-80.
Yes, you can pass a uid
to run the command as. See docs of child_process.exec or child_process.spawn.
Example:
child_process.exec('myScript.sh', {uid: 100})
// Or with .spawn()
child_process.spawn('myScript.sh', [], {uid: 100})