B
B
brezhitskiy422021-04-24 12:35:08
Node.js
brezhitskiy42, 2021-04-24 12:35:08

How to copy files to Nginx folder via Node.js?

Hello. I have a node.js server that I run with nodemon via a user that has sudo access. When I try to copy a file to the sites-available folder, I get an Error: EACCES: permission denied. I understand that the problem is in the user who runs the node script. How can this problem be solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2021-04-24
@bingo347

1. Create a new user group
2. Add the nginx user (usually www-data) to it and the user under which node is launched
3. Assign this group the owner of the folder in which you want to write and open write permissions for the group

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question