[Mailman-Users] Disabling passwords
Dan Mick
Dan.Mick at west.sun.com
Thu Nov 2 03:48:19 CET 2000
> >> Or is there a way to set a password whitout having to go through the
> >> webinterface.
>
> >> I have to change the passwords for over a 100 users on 20 lists so some
> >> sort of command line tool/python script that takes a mailinglist username
> >> and passwd would come in very handy.
>
> > Using withlist, it would be pretty easy to write; the passwords
> > are stored in a simple array indexed by username.
>
> > Of course you have to know a little bit of Python. If you're
>
> Ehm, yeah,
> that's my main problem.
> I know almost no Python
> (in fact all I know is that it's loops are indent based ;) )
>
> > desperate I'll hack something up for you. Meanwhile here's the
>
> Please do. I really am desperate ;)
So, it's been forever since you asked, but here's a way to change
user passwords from the commandline:
First, get patch 102211 for withlist from sourceforge:
https://sourceforge.net/patch/?func=detailpatch&patch_id=102211&group_id=103
Here it is, in case you want to apply it without dealing with sourceforge,
but beware the cut'n'paste monsters.
Index: withlist
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/withlist,v
retrieving revision 1.10
diff -u -r1.10 withlist
--- withlist 2000/09/11 03:58:57 1.10
+++ withlist 2000/11/02 00:49:55
@@ -134,10 +134,11 @@
except getopt.error, m:
usage(m)
- if len(args) <> 1:
+ if len(args) < 1:
usage('No list name supplied.')
listname = string.lower(args[0])
+ args = args[1:]
lock = 0
run = None
@@ -170,7 +171,7 @@
write('Importing', module, '...', file=sys.stderr)
mod = __import__(module)
write('Running %s.%s()' % (module, callable), '...', file=sys.stderr)
- r = getattr(mod, callable)(m)
+ r = getattr(mod, callable)(m, args)
Next, use this file with the new withlist:
def pw(list, args):
list.Lock()
while args:
a = args[0]; del args[0]
p = args[0]; del args[0]
print "%s's password changed from '%s' to '%s'" % \
(a, list.passwords[a], p)
list.passwords[a] = p
list.Save()
list.Unlock()
as follows:
bin/withlist -r pw.pw <user> <newpass> [ <user> <newpass> ... ]
Not much error-checking; I leave that to you. But it works.
More information about the Mailman-Users
mailing list