strongloop-forks / passwd-user

Get the passwd user entry from a username or uid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

passwd-user Build Status

Get the passwd user entry from a username or uid

Works on OS X and Linux.

Instal

$ npm install --save passwd-user

Usage

var passwdUser = require('passwd-user');

passwdUser.sync('sindresorhus');
/*
{
	username: 'sindresorhus',
	password: '*',
	uid: 501,
	gid: 20,
	fullname: 'Sindre Sorhus',
	homedir: '/home/sindresorhus',
	shell: '/bin/zsh'
}
*/

// or
passwdUser.sync(501);

// or
passwdUser.sync(process.getuid());

API

Accepts a username or uid number and returns an object with:

  • username
  • password
  • uid: user ID
  • gid: group ID
  • fullname: name of user
  • homedir: home directory
  • shell: default shell

passwdUser(username | uid, callback)

passwdUser.sync(username | uid)

Related

  • username - get the users username (cross-platform)
  • fullname - get the users fullname (cross-platform)

License

MIT © Sindre Sorhus

About

Get the passwd user entry from a username or uid

License:MIT License


Languages

Language:JavaScript 100.0%