geteuid

Return the effective numeric user identity of the calling process.

Usage

var geteuid = require( '@stdlib/process/geteuid' );

geteuid()

Returns the effective numeric user identity of the calling process.

var id = geteuid();

Notes

  • The function only returns an integer user identity on POSIX platforms. For all other platforms (e.g., Windows, browsers, and Android), the function returns null.
  • See geteuid(2).

Examples

var geteuid = require( '@stdlib/process/geteuid' );

var uid = geteuid();
if ( uid === 0 ) {
    console.log( 'Effectively running as root.' );
} else {
    console.log( 'uid: %d', uid );
}
Did you find this page helpful?