New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

linux-user

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linux-user

Node module for Linux user and group control.

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

linux-user

NPM

Node module for Linux user and group control.

Use Node to manage Linux user easily. All APIs do what you think.

The module must be running on Linux and as root user !

Installation

$ npm install linux-user --save

Usage

Examples

  • add Linux user
var linuxUser = require('linux-user');

linuxUser.addUser('gkuchan', function (err, user) {
  if(err) {
    return console.error(err);
  }
  console.log(user);
  // ------------------------------------------
  // { username: 'gkuchan',
  //   password: 'x',
  //   uid: 1001,
  //   gid: 1001,
  //   fullname: '',
  //   homedir: '/home/gkuchan',
  //   shell: '/usr/sbin/nologin' }
  // ------------------------------------------
});
  • get users
var linuxUser = require('linux-user');

linuxUser.getUsers(function (err, users) {
  if(err) {
    return console.error(err);
  }
  console.log(users);
  // ------------------------------------------
  // [ { username: 'root',
  //   password: 'x',
  //   uid: 0,
  //   gid: 0,
  //   fullname: 'root',
  //   homedir: '/root',
  //   shell: '/bin/bash' },
  // { username: 'daemon',
  //   password: 'x',
  //   uid: 1,
  //   gid: 1,
  //   fullname: 'daemon',
  //   homedir: '/usr/sbin',
  //   shell: '/usr/sbin/nologin' },
  // { username: 'bin',
  //   password: 'x',
  //   uid: 2,
  //   gid: 2,
  //   fullname: 'bin',
  //   homedir: '/bin',
  //   shell: '/usr/sbin/nologin' } ]
  //   ------------------------------------------
  });

Core APIs

  • linuxUser.addUser(username, callback)
    • username String
    • callback function(err, userInfo)
  • linuxUser.removeUser(username, callback)
    • username String
    • callback function(err)
  • linuxUser.getUsers(callback)
    • callback function(err, usersInfo)
  • linuxUser.getUserInfo(username, callback)
    • username String
    • callback function(err, userInfo)
  • linuxUser.setPassword(username, password, callback)
    • username String
    • password String
    • callback function(err)
  • linuxUser.addGroup(groupname, callback)
    • groupname String
    • callback function(err, groupInfo)
  • linuxUser.removeGroup(groupname, callback)
    • groupname String
    • callback function(err)
  • linuxUser.getGroups(callback)
    • callback function(err, groupsInfo)
  • linuxUser.getGroupInfo(groupname, callback)
    • groupname String
    • callback function(err, groupInfo)
  • linuxUser.addUserToGroup(username, groupname, callback)
    • username String
    • groupname String
    • callback function(err)

Other APIs

  • linuxUser.validateUsername(username)
    • return boolen
    check a string is a valid linux username or not

License

MIT

Keywords

FAQs

Package last updated on 27 Dec 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc