Friday 21 April 2017

spawn new process in Node.js with different UID/GID does not work?

Why when I spawn a process from root user with different UID/GID it still says that the process is run as root?

const spawn = require('child_process').spawn;
const ps = spawn('watch', ['ps', 'ax'], {
  uid : 1000,
  gid : 1000,
  detached : true
});

const os = require('os');
console.log(os.userInfo());

I get this as output:

>>> node test.js 
{ uid: 0,
  gid: 0,
  username: 'root',
  homedir: '/root',
  shell: '/bin/bash' }



via Unitech

No comments:

Post a Comment