droppriv
v0.0.2
Published
Drops root privileges from current running script
Downloads
2
Readme
Installation
$ npm install droppriv
Examples
Predefined user:
require('droppriv')('user', 'group');
From env SETUID and SETGUID (nobody:nogroup if not set):
require('droppriv')(process.env.SETUID || 'nobody', process.env.SETGID || 'nogroup');
If you want log droppriv:
require('droppriv')(
process.env.SETUID || 'nobody',
process.env.SETGID || 'nogroup',
true
);
Or custom logging function:
var winston = require('winston');
winston.cli();
require('droppriv')(
process.env.SETUID || 'nobody',
process.env.SETGID || 'nogroup',
winston.info
);
Requirements
- POSIX OS (Linux, FreeBSD, etc). Does nothing on Windows (doesn't fail).