node package manager

downgrade-root

downgrade-root Build Status

Try to downgrade the permissions of a process with root privileges

Usually applies to a process started with sudo.

Windows is gracefully ignored as it lacks a way to set UID.

Install

$ npm install --save downgrade-root

Usage

var downgradeRoot = require('downgrade-root');
 
try {
    downgradeRoot();
} catch (err) {
    console.error('Couldn\'t downgrade permissions');
}

Tip

Useful for trying to downgrade permission before blocking using your app as root.

License

MIT © Sindre Sorhus