[Mailman-Users] Setting users password from command line

Michael Keightley Michael.Keightley at quadstone.com
Mon Mar 11 18:34:00 CET 2002


On Mon, Mar 11, 2002 at 10:12:25AM -0500, Jon Carnes wrote:
> You could create one user and then use ~mailman/bin/clone_member to create
> each of the other users of a mailing list.  That way they will all start off
> with the same password....
> 
> Other than that, your best bet would be to modify the add_members script so
> that it lets you specify a password for each user.
I have created a new add_members script with an extra "-p <password>" option.
Here are the diffs for v2.0.8, if anyone else is interested....

--- add_members.FCS	Mon Mar 11 09:25:11 2002
+++ add_members	Mon Mar 11 17:27:10 2002
@@ -26,10 +26,13 @@
 """Add members to a list from the command line.
 
 Usage:
-    add_members [-n <file>] [-d <file>] [-c <y|n>] [-w <y|n>] [-h] listname
+    add_members [-p <password>] [-n <file>] [-d <file>] [-c <y|n>] [-w <y|n>] [-h] listname
 
 Where:
 
+    --password <password>
+    -p <password>
+        Set the password
     --non-digest-members-file <file>
     -n <file>
         A file containing addresses of the members to be added, one
@@ -120,9 +123,10 @@
 def main():
     try:
         opts, args = getopt.getopt(sys.argv[1:],
-                                   'n:d:c:w:h',
+                                   'p:n:d:c:w:h',
                                    ['non-digest-members-file=',
                                     'digest-members-file=',
+                                    'password=',
                                     'changes-msg=',
 				    'welcome-msg=',
                                     'help'])
@@ -135,11 +139,14 @@
     listname = string.lower(args[0])
     nfile = None
     dfile = None
+    passwd = []
     send_changes_msg = 0
     send_welcome_msg = -1
     for opt, arg in opts:
         if opt in ('-h', '--help'):
             usage(0)
+        elif opt in ('-p','--password'):
+            passwd.append(arg)
         elif opt in ('-d', '--digest-members-file'):
             dfile = arg
         elif opt in ('-n', '--non-digest-members-file'):
@@ -192,11 +199,11 @@
             usage(1)
 
         if nmembers:
-            nres = ml.ApprovedAddMembers(nmembers, None, 0, send_welcome_msg)
+            nres = ml.ApprovedAddMembers(nmembers, passwd, 0, send_welcome_msg)
         else: nres = {}
 
         if dmembers:
-            dres = ml.ApprovedAddMembers(dmembers, None, 1, send_welcome_msg)
+            dres = ml.ApprovedAddMembers(dmembers, passwd, None, 1, send_welcome_msg)
         else: dres = {}
 
         for result in (nres, dres):
> 
> Jon Carnes
> ----- Original Message -----
> From: "Michael Keightley" <Michael.Keightley at quadstone.com>
> To: <mailman-users at python.org>
> Sent: Monday, March 11, 2002 6:06 AM
> Subject: [Mailman-Users] Setting users password from command line
> 
> 
> > We are hoping to migrate our mailing lists over to Mailman in the near
> future.
> > To do this we will need to add all users in our current mailing lists
> using the
> > add_members command.  Is there anyway to set a password with this, rather
> than
> > one being generated randomly?  We want to allocate a password initially to
> each
> > users so when we migrate to mailman a user doesn't have 20 passwords for
> the 20
> > mailing lists they might currently be on.
> >
> > Michael
> > --
> > Michael Keightley <Michael.Keightley at quadstone.com>    Tel: +44 131 220
> 4491
> > Systems Manager, Quadstone Limited,                    Fax: +44 131 220
> 4492
> > 16 Chester Street, Edinburgh EH3 7RA, Scotland
> http://www.quadstone.com
> >
> > ------------------------------------------------------
> > Mailman-Users mailing list
> > Mailman-Users at python.org
> > http://mail.python.org/mailman/listinfo/mailman-users
> > Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py

-- 
Michael Keightley <Michael.Keightley at quadstone.com>    Tel: +44 131 220 4491
Systems Manager, Quadstone Limited,                    Fax: +44 131 220 4492
16 Chester Street, Edinburgh EH3 7RA, Scotland         http://www.quadstone.com




More information about the Mailman-Users mailing list