Accessing file on disk - Incorrect permissions

I need to access a file on desk to create a demo. No Luck. here is what I have done.

Uninstalled and re-installed. Solved other problems accept the file access isse.
Rechecked the file for the correct permissions. Granted Full permissions.

-rwxrwxrwx 1 pieter pieter 48441 Oct 8 09:50 sampledata.json

Checked user has full acces to folders. all is good. see above

Yet everytime I want to access the file I get the following error

Error: EACCES: permission denied, open '/home/pieter/Documents/AWSSamples/sampledata.json'

What account does node-red run under? Possibly not pieter?

Not sure since it does not ask me for logon access. Yet checking the users and groups, cannot find the normal node-red user or group.

How did you install Node-RED/how do you start it?

If you need a quick way to know which user it runs at, try the following flow:

[{"id":"4e48d39.82fbcac","type":"inject","z":"d641cc9a.35b15","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":500,"wires":[["b19e703e.217458"]]},{"id":"b19e703e.217458","type":"exec","z":"d641cc9a.35b15","command":"whoami","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":300,"y":500,"wires":[["3c00b4e5.690a4c"],[],[]]},{"id":"3c00b4e5.690a4c","type":"debug","z":"d641cc9a.35b15","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":500,"wires":[]}]

which runs whoami and tells you the user it is running at.

Forgot to add. Fresh Ubuntu install on laptop

Probably running as a service. As I have no idea what system you fly, it's difficult to help. However I'm fairly sure it's not your account.

10/10/2019, 2:18:21 PMnode: 7eb0ba89.c7fd7c

msg.payload : string[0]

""

Error 126!

10/10/2019, 2:22:17 PMnode: 7eb0ba89.c7fd7c

msg.payload : string[38]

string[38]

/bin/sh: 1: whoami: Permission denied

How did you install node red and how are you running it?

Installed it from system apps "Ubuntu Software Icon" and running directly from webpage "http://localhost:1880/#flow/3534930b.2a47b4"

I only logged on with the default user (Pieter)

In the original post you gave permissions to pieter and you log on with Pieter! There is a difference.

Does node-red run from command line or as a service?

If it's a service then I guess some service account is running node-red and it's this account that is trying to access the file - not pieter

I suggest you read up on services and accounts for Ubuntu.

Perhaps your file should be moved to inside .node-red folder?

1 Like

Run as a services, since it is only started from the the webpage. Or is this not correct?

From the command prompt run top or htop and you can see which user is running node-red.

the node-red folder has all Root privileges and the user must only have access to files under /Documents.

It's a permissions error. You need to do some research. I don't have an Ubuntu to hand so can't help further.

Read up on services and accounts under Ubuntu to figure it out.

Try this...

Running Top from terminal. Do not see node-red listed. Even after restarting it and doing a cache clear on the browser.

You won't see node-red, you'll see node

Did you try ps -ef like the link said?

Running it from the web page (as you put it) is not running node red it is just opening a web page on it. I believe it will have installed using the node-red snap, and has probably been autostarted as a service. What do you see if you run
sudo systemctl status nodered
also run

node-red-stop
node-red-start

and copy/paste the result here.