How to run pm2 so other server users are able to access the process?

Here’s how we bypassed this.

Just create a group

  • Create a new group pm2 or whatever name works for you

    $ groupadd pm2

  • Change the /var/www/ folder group owner to group pm2

    $ chgrp -R pm2 /var/www

  • Add the other user, let’s say bob, to pm2

    $ usermod -aG pm2 bob

Now bob can run pm2 commands by changing $HOME to /var/www

$ env HOME=/var/www pm2 list

Or (better still) create an alias as @jcollum suggested

$ alias pm2='env HOME=/var/www pm2'

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)