Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run pm2 as another user #4058

Closed
anutting opened this issue Dec 4, 2018 · 4 comments
Closed

Cannot run pm2 as another user #4058

anutting opened this issue Dec 4, 2018 · 4 comments

Comments

@anutting
Copy link

anutting commented Dec 4, 2018

pm2d version         : 3.2.2
node version         : 8.12.0

pm2 start ecosystem.config.js --uid node --env production has now all of a sudden given the error: uid must be an integer. I am the root user and this has been working all along.

I've also tried:
pm2 start ecosystem.config.js -u node --env production : doesn't do anything, process is owned by root.
pm2 start ecosystem.config.js --uid $(id -u node) --env production : same error uid must be an integer
pm2 start ecosystem.config.js --uid 1003 --env production : same error uid must be an integer

god daemon is running as root and PM2_HOME is set a /home/node/.pm2

@Unitech
Copy link
Owner

Unitech commented Dec 19, 2018

In the ecosystem.config.js, can you declare the user under the user attribute; like that:

 module.exports = [{
      "name": "electron",
      "script": "./node_modules/.bin/electron",
      "args": "./electron",
      "user": "envision",
      "time": true,
      "max_memory_restart": "1000M",
      "restart_delay": "10000",
      "env": {
        "ENVISION_ENV": "production",
        "DISPLAY": ":0"
      }
    }]

@Unitech
Copy link
Owner

Unitech commented Dec 19, 2018

uid must be an integer? this is weird, please upgrade pm2:

$ npm install pm2@latest -g
$ pm2 update

You should not get this must be an integer error

@ksemaev
Copy link

ksemaev commented Apr 26, 2019

@Unitech I use latest pm2 v3.5.0 and get the same must be an integer:

root@ip:~# pm2 start /etc/price/ecosystem.config.js --uid 1009
[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
[PM2][WARN] Applications exodus-pricing-server-backend not running, starting...
[PM2][ERROR] Process failed to launch The "options.uid" property must be of type int32. Received type string```

@ksemaev
Copy link

ksemaev commented Apr 26, 2019

@Unitech also adding "user": "price", does not change anything, it still runs under root

Unitech added a commit that referenced this issue Oct 11, 2019
Fix: Allow usernames in uid/gid/user again (fixes #4058, #4262)
inerc pushed a commit to inerc/pm2 that referenced this issue Feb 11, 2020
Fix: Allow usernames in uid/gid/user again (fixes Unitech#4058, Unitech#4262)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants