Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

updated readme

  • Loading branch information...
commit 628c3f9d1c4a8446cf8e895c3189203ab7ce4840 1 parent f89be7b
Peteris Krumins authored April 07, 2011

Showing 1 changed file with 22 additions and 5 deletions. Show diff stats Hide diff stats

  1. 27  readme.txt
27  readme.txt
@@ -10,13 +10,31 @@ Here is an example usage:
10 10
 
11 11
     var passwd = require('passwd');
12 12
 
13  
-    passwd.add('pkrumins', 'password', { createHome : true }); // calls `useradd -p shadowpassword -m pkrumins`
  13
+    // add a new user (calls `useradd -m -p shadowPass pkrumins`)
  14
+    passwd.add('pkrumins', 'password', { createHome : true }, function (status) {
  15
+        if (status == 0) {
  16
+            console.log('great success! pkrumins added!');
  17
+        }
  18
+        else {
  19
+            console.log('not so great success! pkrumins not added! useradd command returned: ' + status);
  20
+        }
  21
+    });
  22
+
  23
+
  24
+    // calls `userdel pkrumins`
  25
+    passwd.del('pkrumins', function (status) { ... });
14 26
 
15  
-    passwd.del('pkrumins'); // calls `userdel pkrumins`
  27
+    // locks user pkrumins via `usermod -L pkrumins`
  28
+    passwd.lock('pkrumins', function (status) { ... })
16 29
 
17  
-    passwd.get('pkrumins', function (user) { ... }) // gets 'pkrumins' user entry from /etc/passwd
  30
+    // unlocks user pkrumins via `usermod -U pkrumins`
  31
+    passwd.unlock('pkrumins', function (status) { ... })
18 32
 
19  
-    passwd.getAll(function (users) { // gets all users from /etc/passwd
  33
+    // gets 'pkrumins' user entry from /etc/passwd
  34
+    passwd.get('pkrumins', function (user) { ... })
  35
+
  36
+    // gets all users from /etc/passwd
  37
+    passwd.getAll(function (users) {
20 38
         users.forEach(function (user) {
21 39
             console.log(user.username);
22 40
         });
@@ -26,7 +44,6 @@ That's it.
26 44
 
27 45
 ------------------------------------------------------------------------------
28 46
 
29  
-
30 47
 Sincerely,
31 48
 Peteris Krumins (twitter: @pkrumins)
32 49
 http://www.catonmat.net

0 notes on commit 628c3f9

Please sign in to comment.
Something went wrong with that request. Please try again.