{"action":"created","issue":{"url":"https://api.github.com/repos/Unitech/pm2/issues/2957","repository_url":"https://api.github.com/repos/Unitech/pm2","labels_url":"https://api.github.com/repos/Unitech/pm2/issues/2957/labels{/name}","comments_url":"https://api.github.com/repos/Unitech/pm2/issues/2957/comments","events_url":"https://api.github.com/repos/Unitech/pm2/issues/2957/events","html_url":"https://github.com/Unitech/pm2/issues/2957","id":237703154,"number":2957,"title":"User's  group ids  miss when  the app start by pm2","user":{"login":"chaoliu","id":1416354,"avatar_url":"https://avatars0.githubusercontent.com/u/1416354?v=3","gravatar_id":"","url":"https://api.github.com/users/chaoliu","html_url":"https://github.com/chaoliu","followers_url":"https://api.github.com/users/chaoliu/followers","following_url":"https://api.github.com/users/chaoliu/following{/other_user}","gists_url":"https://api.github.com/users/chaoliu/gists{/gist_id}","starred_url":"https://api.github.com/users/chaoliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaoliu/subscriptions","organizations_url":"https://api.github.com/users/chaoliu/orgs","repos_url":"https://api.github.com/users/chaoliu/repos","events_url":"https://api.github.com/users/chaoliu/events{/privacy}","received_events_url":"https://api.github.com/users/chaoliu/received_events","type":"User","site_admin":false},"labels":[{"id":106715799,"url":"https://api.github.com/repos/Unitech/pm2/labels/S:%20Need%20More%20Data","name":"S: Need More Data","color":"bfdadc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-06-22T00:50:16Z","updated_at":"2017-06-26T08:57:35Z","closed_at":null,"body":"**What's going wrong?**\r\nUser's  group ids  miss when  the app start by pm2\r\n\r\n**How could we reproduce this issue?**\r\n\r\n### 1 A user which has multiple groups, for example , garen in (garen, webdev, hxzhao).\r\n```\r\n[garen@hi-dev-02 upload]$ id\r\nuid=538(garen) gid=539(garen) groups=539(garen),526(webdev),543(hxzhao) context=system_u:system_r:unconfined_t:s0-s0:c0.c1023\r\n```\r\n### 2 A test script \r\n\r\n```\r\n[garen@hi-dev-02 upload]$ cat index.js\r\nconst child_process = require('child_process');\r\n// let result = child_process.execSync('/usr/sbin/nginx -t', {\r\n// gid: 539\r\n// });\r\n\r\n// console.log(result.toString())\r\n\r\nif (process.geteuid) {\r\n    console.log(`Current uid: ${process.geteuid()}`);\r\n}\r\n\r\nconsole.log(`Current gids: ${process.getgroups()}`)\r\n\r\n```\r\n\r\n### 3 when I run it by `node index.js` directly , it works well\r\n\r\n```\r\n[garen@hi-dev-02 upload]$ node index.js\r\nCurrent uid: 538\r\nCurrent gids: 526,539,543\r\n\r\n```\r\n\r\n### 4 then I run it by pm2\r\n```\r\npm2 start --no-autorestart --no-daemon --interpreter node  index.js\r\n```\r\n\r\nthe output is ：\r\n```\r\n[STREAMING] Now streaming realtime logs for [all] processes\r\n08:21:39 17|index   | Current uid: 538\r\n08:21:39 17|index   | [ 539 ]\r\n```\r\n\r\n### summary\r\nGroups missing cause permissions loss,  for example  , in above test script , I cannot exec `nginx -t`, because `nginx` belong to the group `webdev`.\r\n\r\n## Supporting information\r\n\r\n```\r\nPM2 version: `pm2 -v` : 2.5.0\r\nNode version: `node -v` : v7.2.1\r\nWindows? Mac? Linux? : Linux hi-dev-02 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/Unitech/pm2/issues/comments/311001953","html_url":"https://github.com/Unitech/pm2/issues/2957#issuecomment-311001953","issue_url":"https://api.github.com/repos/Unitech/pm2/issues/2957","id":311001953,"user":{"login":"chaoliu","id":1416354,"avatar_url":"https://avatars0.githubusercontent.com/u/1416354?v=3","gravatar_id":"","url":"https://api.github.com/users/chaoliu","html_url":"https://github.com/chaoliu","followers_url":"https://api.github.com/users/chaoliu/followers","following_url":"https://api.github.com/users/chaoliu/following{/other_user}","gists_url":"https://api.github.com/users/chaoliu/gists{/gist_id}","starred_url":"https://api.github.com/users/chaoliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaoliu/subscriptions","organizations_url":"https://api.github.com/users/chaoliu/orgs","repos_url":"https://api.github.com/users/chaoliu/repos","events_url":"https://api.github.com/users/chaoliu/events{/privacy}","received_events_url":"https://api.github.com/users/chaoliu/received_events","type":"User","site_admin":false},"created_at":"2017-06-26T08:57:35Z","updated_at":"2017-06-26T08:57:35Z","body":"Maybe , but not sure.  I'll dig into the source code later. See if there are any solutions."}}
{"actor":{"display_login":"chaoliu"}}