Error: EACCES: permission denied, open '/root/.node-red/flows....json'..'

Hi for all.
This is my first post on my life

I'm trying to make a flows backup.
When execute the file in node in debug windows I see the error on the title

Can anybody helpme? Thanks in advance.

NOTE: I´m nodered and linux beginner and my english isn't very good. Be patience with me please :pray:

You have a problem with your node-red installation as you have installed it as the root user.

This will cause all sorts of issues.

I recommend that you make a copy of /root/.node_red

sudo cp -R /root/.node_red /root/node_red_backup

If this is on Pi, next step is:

sudo chown -r pi:pi /root/node_red_backup

which should reset ownership of the copy to the Pi user (I might be slightly off with that command as it is from memory. Run sudo ls -la /root/node_red_backup and make sure that the Pi user is actually owner of all of the files and folders.

Now copy that backup to the correct location after getting rid of the unnecessary npm packages

rm -R /root/node_red_backup/node_modules
mv ~/.node-red ~/.node-red-old
cp /root/node_red_backup ~/.node-red

Next, make sure node-red isn't running service stop node-red then cd @/.node-red and npm install . Then run node-red manually and make sure that it is working and using the files in the Pi users home folder and not the root ones.

If you set up node-red to run as a service yourself, make sure that you set the user and group to be a real user as per Dave's install script. Then you should be able to reboot.

sudo cp -R /root/.node_red /root/node_red_backup
...

OP first needs to switch to another user before doing this.

Might be a good idea to ask the Original Poster (OP) how well he know Linux. And also what use he was (what user were you logged in as) when you got the error.

First of all Thanks! I don't know very much of Linux neither it's console, so I'm literally a beginner.
I think I'm logged as Pi user so the response of @TotallyInformation is a little confusing for me.
I'm adding a screenshot so you can see my console at the start (pi@....).

It is possible that someone can simplify the idea of @TotallyInformation for me, to try it? I think I previously need to create another user, isn't it?
Captura de pantalla 2021-01-17 a las 21.05.23|525x235
And please remember that in the begining, what I want is to backup nodered flows, I can´t think about delete or crash something.

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