Exec node python [Errno 13] Permission denied - How to set execute permissions

Hi All,

I think this is probably an easy solve.

node-red is running as user node-js-node-red:

[st@luthis /]$ ps -ef | grep node
nodejs-+ 417957 1 0 09:47 ? 00:00:02 node-red

I wrote a file out using write file node:

ll /var/lib/nodejs-node-red/nodelogtesttest
-rw-r--r-- 1 nodejs-node-red nodejs-node-red 6 Jan 27 10:03 nodelogtesttest

That's what it has in the service file:

[st@luthis /]$ cat /usr/lib/systemd/system/nodejs-node-red.service
[Unit]
Description=Node-RED graphical event wiring tool
Wants=network.target
Documentation=https://nodered.org/docs/

[Service]
Type=simple
User=nodejs-node-red
Group=nodejs-node-red
WorkingDirectory=/var/lib/nodejs-node-red
EnvironmentFile=/etc/default/nodejs-node-red
ExecStart=/usr/bin/node-red ${NODE_OPTIONS} ${NODE_RED_OPTIONS}
KillSignal=SIGINT
Restart=on-failure

[Install]
WantedBy=multi-user.target

My passwd file:

[st@luthis /]$ cat /etc/passwd
st:x:1000:1000::/home/st:/bin/bash
nodejs-node-red:x:962:962::/var/lib/nodejs-node-red:/usr/bin/nologin

I added nodejs user to my group:

[st@luthis /]$ cat /etc/group
st:x:1000:nodejs-node-red
nodejs-node-red:x:962:

But none of that has helped this issue which I'm trying to solve. When running an exec I get:

Command failed: python /home/st/Projects/Planner/monitors.py false
python: can't open file '/home/st/Projects/Planner/monitors.py': [Errno 13] Permission denied

Running the python script as myself it works fine.
I am not able to write out a file to home dir with node-red so I understand that node-red doesn't have the right permissions to be able to run the python file or even access anything in my home dir.

I just don't know what else I need to do to get it working.

Also tried changing the user and group in the node-red service file to my user/group (and restarted daemon etc) but that didn't work either.

Any tips?

EDIT:
also the history is I imported this flow from my previous install. computer name changed but user/group didn't. I forgot to export them so I just imported from the json file in my old drive.

What do these commands give you?
ls -ld /home/st
ls -ld /home/st/Projects
ls -ld /home/st/Projects/Planner

Hey thanks for replying, here's the output:

[st@luthis ~]$ ls -ld /home/st
drwx------ 48 st st 4096 Jan 27 10:05 /home/st
[st@luthis ~]$ ls -ld /home/st/Projects
drwxr-xr-x 11 st st 4096 Nov 13 08:48 /home/st/Projects
[st@luthis ~]$ ls -ld /home/st/Projects/Planner
drwxr-xr-x 6 st st 4096 Nov 13 08:46 /home/st/Projects/Planner

I suspect you need to do chmod 755 /home/st

I thought that was where you were going with that. I tried:

[st@luthis ~]$ ls -ld /home/st
drwxr-xr-x 48 st st 4096 Jan 27 10:05 /home/st

No errors now, thanks!

My python script is mysteriously running now with no error but also not turning off my monitor.. but that's a different issue.

Thanks for your help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.