Skip to content
Check if the process is running as root user, for example, one started with `sudo`
Branch: master
Clone or download
Latest commit 4e91119 Mar 22, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitattributes
.gitignore Require Node.js 4 Nov 7, 2017
.npmrc Require Node.js 4 Nov 7, 2017
.travis.yml Require Node.js 6 Mar 22, 2018
index.js Require Node.js 4 Nov 7, 2017
license
package.json 2.0.0 Mar 22, 2018
readme.md Require Node.js 4 Nov 7, 2017
test.js

readme.md

is-root Build Status

Check if the process is running as root user, for example, one started with sudo

Install

$ npm install is-root

Usage

$ sudo node index.js
// index.js
const isRoot = require('is-root');

isRoot();
//=> true

Related

  • is-elevated - Check if the process is running with elevated privileges (cross-platform)

License

MIT © Sindre Sorhus

You can’t perform that action at this time.