Skip to content

Try to downgrade the permissions of a process with root privileges

License

Notifications You must be signed in to change notification settings

sindresorhus/downgrade-root

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

downgrade-root

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 downgrade-root

Usage

import downgradeRoot from 'downgrade-root';

try {
	downgradeRoot();
} catch {
	console.error('Couldn\'t downgrade permissions');
}

Tip

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