1

How to fork a worker under different user with Node.js cluster module?

Oleg
  • 22,300
  • 9
  • 68
  • 84

1 Answers1

1

It can be done by populating cluster.settings object with uid property in master process. In my case it looks like this:

cluster.settings.uid = 10000;

where 10000 is my uid

To get your uid on Linux, run:

id -u <your-user-name-here>

or simply:

id -u
Oleg
  • 22,300
  • 9
  • 68
  • 84