Browse files

updated readme

  • Loading branch information...
1 parent f89be7b commit 628c3f9d1c4a8446cf8e895c3189203ab7ce4840 @pkrumins committed Apr 7, 2011
Showing with 22 additions and 5 deletions.
  1. +22 −5 readme.txt
View
27 readme.txt
@@ -10,13 +10,31 @@ Here is an example usage:
var passwd = require('passwd');
- passwd.add('pkrumins', 'password', { createHome : true }); // calls `useradd -p shadowpassword -m pkrumins`
+ // add a new user (calls `useradd -m -p shadowPass pkrumins`)
+ passwd.add('pkrumins', 'password', { createHome : true }, function (status) {
+ if (status == 0) {
+ console.log('great success! pkrumins added!');
+ }
+ else {
+ console.log('not so great success! pkrumins not added! useradd command returned: ' + status);
+ }
+ });
+
+
+ // calls `userdel pkrumins`
+ passwd.del('pkrumins', function (status) { ... });
- passwd.del('pkrumins'); // calls `userdel pkrumins`
+ // locks user pkrumins via `usermod -L pkrumins`
+ passwd.lock('pkrumins', function (status) { ... })
- passwd.get('pkrumins', function (user) { ... }) // gets 'pkrumins' user entry from /etc/passwd
+ // unlocks user pkrumins via `usermod -U pkrumins`
+ passwd.unlock('pkrumins', function (status) { ... })
- passwd.getAll(function (users) { // gets all users from /etc/passwd
+ // gets 'pkrumins' user entry from /etc/passwd
+ passwd.get('pkrumins', function (user) { ... })
+
+ // gets all users from /etc/passwd
+ passwd.getAll(function (users) {
users.forEach(function (user) {
console.log(user.username);
});
@@ -26,7 +44,6 @@ That's it.
------------------------------------------------------------------------------
-
Sincerely,
Peteris Krumins (twitter: @pkrumins)
http://www.catonmat.net

0 comments on commit 628c3f9

Please sign in to comment.