process.seteuid()

process.seteuid(id)

Note: this function is only available on POSIX platforms (i.e. not Windows, Android)

Sets the effective user identity of the process. (See seteuid(2).) This accepts either a numerical ID or a username string. If a username is specified, this method blocks while resolving it to a numerical ID.

if (process.geteuid && process.seteuid) {
  console.log(`Current uid: ${process.geteuid()}`);
  try {
    process.seteuid(501);
    console.log(`New uid: ${process.geteuid()}`);
  }
  catch (err) {
    console.log(`Failed to set uid: ${err}`);
  }
}
doc_Nodejs
2016-04-30 04:41:21
Comments
Leave a Comment

Please login to continue.