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

**URL:** <https://discourse.nodered.org/t/exec-node-python-errno-13-permission-denied-how-to-set-execute-permissions/57293>\
**Category:** General\
**Created:** [26 January 2022 21:27 UTC](https://discourse.nodered.org/t/exec-node-python-errno-13-permission-denied-how-to-set-execute-permissions/57293 "2022-01-26T21:27:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![luthis](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@luthis](https://discourse.nodered.org/u/luthis)\
**Post date:** [26 January 2022 21:27 UTC](https://discourse.nodered.org/t/exec-node-python-errno-13-permission-denied-how-to-set-execute-permissions/57293/1 "2022-01-26T21:27:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [26 January 2022 21:43 UTC](https://discourse.nodered.org/t/exec-node-python-errno-13-permission-denied-how-to-set-execute-permissions/57293/2 "2022-01-26T21:43:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![luthis](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@luthis](https://discourse.nodered.org/u/luthis)\
**Post date:** [26 January 2022 22:13 UTC](https://discourse.nodered.org/t/exec-node-python-errno-13-permission-denied-how-to-set-execute-permissions/57293/3 "2022-01-26T22:13:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [26 January 2022 22:22 UTC](https://discourse.nodered.org/t/exec-node-python-errno-13-permission-denied-how-to-set-execute-permissions/57293/4 "2022-01-26T22:22:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![luthis](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@luthis](https://discourse.nodered.org/u/luthis)\
**Post date:** [26 January 2022 22:34 UTC](https://discourse.nodered.org/t/exec-node-python-errno-13-permission-denied-how-to-set-execute-permissions/57293/5 "2022-01-26T22:34:12Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 February 2022 22:34 UTC](https://discourse.nodered.org/t/exec-node-python-errno-13-permission-denied-how-to-set-execute-permissions/57293/6 "2022-02-09T22:34:27Z")

</div>

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