Pm2: Error: EACCES: permission denied, mkdir

Created on 4 Dec 2015  路  6Comments  路  Source: Unitech/pm2

hi

i run my app thru pm2, no problems to start andrun the app BUT

i have to write and read files froms one dir wich has specific permissions (on linux)

my pm2 run as user "webuser" so i added this user to the same group of my dir where i have to write files...

i still have Error: EACCES: permission denied on mkdir or fs.readdir ...

even if i change the dir permissions to 0777 i still have this error !!! :/

an idear ?

thanks

Most helpful comment

Our problem ended up the fact that permissions have changed after the pm2 daemon has been launched. The user that pm2 was forking processes under was not listed in the new group it has been added to for the current instance of the daemon.

What solved the issue was running pm2 kill, and relaunching all the processes monitored by pm2 (and thereby the daemon itself).

That way the newly added group membership of the operating system user and all of its' consequences regarding permissions were applied.

All 6 comments

edit

tried by starting my app without pm2 = no problems
tried thru nodemon = no problems

problem come with pm2

thanks

edit:

have this problem only in cluster mode

no problems if i only have 1 pm2 process

Please fix rights problem on ~/.pm2 with chown command

hello

i don t see what it has聽 To do with my issue
.. Oo

my聽 pm2 rights are good

please read user s issues before closing them

thanks

Envoy茅 par TypeMail

Sur 7 d茅c. 2015 16:33, 脿 16:33, Alexandre Strzelewicz [email protected] a 茅crit:

Please fix rights problem on ~/.pm2 with chown command


Reply to this email directly or view it on GitHub:
https://github.com/Unitech/pm2/issues/1815#issuecomment-162559069

Having the exact same issue here, a script ran with node and pm2 by the same user fails to access a folder that is accessible to that user. The problem happens only when running the script under pm2.
ps -aux shows the node fork started by pm2 running under the correct user, but still I get EACCES errors.
@israelidanny

Our problem ended up the fact that permissions have changed after the pm2 daemon has been launched. The user that pm2 was forking processes under was not listed in the new group it has been added to for the current instance of the daemon.

What solved the issue was running pm2 kill, and relaunching all the processes monitored by pm2 (and thereby the daemon itself).

That way the newly added group membership of the operating system user and all of its' consequences regarding permissions were applied.

Was this page helpful?
0 / 5 - 0 ratings