I am trying to start a node.js application with on a low permissions user. All the files I know of are owned by the correct user and have permissions set reasonably well. I'm trying to use a script file to do this. I invoke the script with this command
sudo su - nodejs ./start-apps.sh
The shell script runs this command to start the app
cd "/home/nodejs/my-app"
npm start
npm start is documented here. It basically pulls the command to use out of the package.json file, which in our app looks like this:
// snip
"scripts": {
"start": "node-dev app"
},
And it spits out the error:
> [email protected] start /home/nodejs/my-app
> node-dev app
sh: 1: node-dev: Permission denied
npm ERR! [email protected] start: `node-dev app`
npm ERR! Exit status 126
That sh seems to be saying that it's reporting errors from the shell command. I don't think the problem is accessing the npm command itself, because if it were, the permission denied would be raised before any output from the npm command. But just to rule it out, here are the permissions for the npm command itself:
$ sudo find / ! \( -type d \) -name npm -exec ls -lah {} \;
-rwxr-xr-x 1 root root 274 Nov 12 20:22 /usr/local/src/node-v0.10.22/deps/npm/bin/npm
-rwxr-xr-x 1 root root 274 Nov 12 20:22 /usr/local/lib/node_modules/npm/bin/npm
lrwxrwxrwx 1 root root 38 Jan 14 07:49 /usr/local/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js
It looks like everyone should be able to execute it.
The permissions for node-dev look like this:
$ sudo find / ! \( -type d \) -name node-dev -exec ls -lah {} \;
-rwxr-xr-x 1 nodejs nodejs 193 Mar 3 2013 /home/nodejs/.npm/node-dev/2.1.4/package/bin/node-dev
-rw-r--r-- 1 nodejs nodejs 193 Mar 3 2013 /home/nodejs/spicoli-authorization/node_modules/node-dev/bin/node-dev
lrwxrwxrwx 1 root root 24 Jan 14 07:50 /home/nodejs/spicoli-authorization/node_modules/.bin/node-dev -> ../node-dev/bin/node-dev
I've already tried chowning the link to nodejs:nodejs, but the scrip experiences the same error.
Is there some file permissions problem I'm not seeing with the binary files? Or is this an npm/node-dev specific error?