07-21-2023, 03:32 PM
**When I start my Nodejs app with [pm2][1], other server users are not able to access the process.**
Even if I start pm2 from a custom directory (not current user's `~/`, what pm2 is using by default):
HOME=/var/www pm2 start app.js
*Directory is accessible by any user* (comparing to `~/`, but there's still no way other server user is able to access the process.
When other server user does `pm2 list`, it shows him 0 processes are running – but there are (started by another user). And when other user tries `HOME=/var/www pm2 list`, CLI throws an error:
events.js:72
throw er; // Unhandled 'error' event
^
Error: connect EACCES
at errnoException (net.js:905:11)
at Object.afterConnect [as oncomplete] (net.js:896:19)
So I am wondering how to make sure users are able to access pm2 processes run by other server users? Or it shall be approached differently?
----------
I am wondering why every server user is able to make `git pull` to deploy latest source code from a Git repository, but can't restart `pm2` process afterwards? Only the user that started `pm2` process is able to restart it… Weird.
[1]:
Even if I start pm2 from a custom directory (not current user's `~/`, what pm2 is using by default):
HOME=/var/www pm2 start app.js
*Directory is accessible by any user* (comparing to `~/`, but there's still no way other server user is able to access the process.
When other server user does `pm2 list`, it shows him 0 processes are running – but there are (started by another user). And when other user tries `HOME=/var/www pm2 list`, CLI throws an error:
events.js:72
throw er; // Unhandled 'error' event
^
Error: connect EACCES
at errnoException (net.js:905:11)
at Object.afterConnect [as oncomplete] (net.js:896:19)
So I am wondering how to make sure users are able to access pm2 processes run by other server users? Or it shall be approached differently?
----------
I am wondering why every server user is able to make `git pull` to deploy latest source code from a Git repository, but can't restart `pm2` process afterwards? Only the user that started `pm2` process is able to restart it… Weird.
[1]:
[To see links please register here]