🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

passwd-user

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passwd-user

Get the passwd user entry from a username or user identifier (UID)

4.0.0
latest
Source
npm
Version published
Weekly downloads
354K
14.36%
Maintainers
1
Weekly downloads
 
Created
Source

passwd-user

Get the passwd user entry from a username or user identifier (UID)

Works on macOS and Linux. See user-info if you need cross-platform support.

Install

npm install passwd-user

Usage

import {passwdUser} from 'passwd-user';

console.log(await passwdUser('sindresorhus'));
/*
{
	username: 'sindresorhus',
	password: '*',
	userIdentifier: 501,
	groupIdentifier: 20,
	fullName: 'Sindre Sorhus',
	homeDirectory: '/home/sindresorhus',
	shell: '/bin/zsh'
}
*/

await passwdUser(501);
console.log('Got entry for user 501');

const user = await passwdUser();
console.log(`Got entry for user ${user.userIdentifier}`);

API

Returns an object with:

  • username
  • password
  • userIdentifier: UID
  • groupIdentifier: GID
  • fullName: Name of user
  • homeDirectory: Home directory
  • shell: Default shell

passwdUser(username?)

passwdUser(userIdentifier?)

Returns a Promise<object> with the user entry.

passwdUserSync(username?)

passwdUserSync(userIdentifier?)

Returns an object with the user entry.

username

Type: string

The username to look up.

userIdentifier

Type: number
Default: process.getuid() (The current user)

The user identifier (UID) to look up.

  • username - Get the user's username (cross-platform)
  • fullname - Get the user's fullname (cross-platform)

Keywords

passwd

FAQs

Package last updated on 04 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts