I have a node.js script which executes some shell commands (using ShellJS). The script is supposed to be executed as a specific user. I'm using sudo to achieve this:
sudo -u username script.js
Everything works as expected when executed on Ubuntu or Debian. However, on Red Hat the script hangs inexplicably at this line:
response = shell.exec('whoami', { silent: true });
(Note that this only happens when trying to run it as a different user than the current one. Also, running a different command than whoami doesn't make a difference.)
Both node (v0.10.x) and npm are installed from the EPEL repo. Any idea what could be the problem here?
Thanks!