passwd-user
Get the passwd user entry from a username or user identifier (UID)
Last updated 4 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install passwd-user 
SYNC missed versions from official npm registry.

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.

Related

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

Current Tags

  • 4.0.0                                ...           latest (4 years ago)

11 Versions

  • 4.0.0                                ...           4 years ago
  • 3.0.0                                ...           7 years ago
  • 2.1.0                                ...           10 years ago
  • 2.0.0                                ...           10 years ago
  • 1.2.1                                ...           11 years ago
  • 1.2.0                                ...           11 years ago
  • 1.1.1                                ...           11 years ago
  • 1.1.0                                ...           11 years ago
  • 1.0.1                                ...           11 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |