This is a node module for controlling passwd(5) (/etc/passwd) and group(5) (/etc/group) in your nodeJS application.
It was orginally written by Peteris Krumins (@pkrumins) (https://github.com/pkrumins/node-passwd)
Modified by @Burnett01 - now with group(5)
Users
var manager = ; //Users // add a new user manager; // calls `userdel pkrumins` manager; // locks user pkrumins via `usermod -L pkrumins` manager // unlocks user pkrumins via `usermod -U pkrumins` manager // gets 'pkrumins' user entry from /etc/passwd manager // gets all users from /etc/passwd manager;
A user-entry looks like:
username : string password : userId : integer groupId : integer name : string homedir : string shell : string
Groups
// add a new group manager; // delete a group manager; // gets 'pkrumins' group entry from /etc/group manager // gets all groups from /etc/group manager;
A group-entry looks like:
name : string password : id : integer members : array
API
/* ++++++++++++++++++++++ ++++ User Methods ++++ ++++++++++++++++++++++*/ exports; exports.delUser = function (username, opts, cb); exports.lockUser = function (username, opts, cb); exports.unlockUser = function (username, opts, cb); exports.passwd = function (username, pass, opts, cb); exports.getAllUsers = _getUsers; exports.getUser = function (username, cb); /* +++++++++++++++++++++++ ++++ Group Methods ++++ +++++++++++++++++++++++*/ exports.addGroup = function (name, opts, cb); exports.delGroup = function (name, opts, cb); exports.getAllGroups = _getGroups; exports.getGroup = function (name, cb);
If you need help just file a new issue. Pull-requests are very welcome.