Size: 2710
Comment:
|
← Revision 5 as of 2015-02-08 11:23:31 ⇥
Size: 2322
Comment: wikification
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
#pragma page-filename DOC/versions/4292612 | #pragma page-filename DOC/versions/4030546 |
Line 3: | Line 3: |
This scripting trick works for 2.x versions of Mailman, and | |
Line 5: | Line 4: |
relies on bin/withlist to work. | This scripting trick works for 2.x versions of Mailman, and relies on bin/withlist to work. |
Line 7: | Line 6: |
1) Become the "mailman" user, eg "su - mailman". | 1) Become the "mailman" user, eg `su - mailman`. |
Line 10: | Line 9: |
Line 12: | Line 10: |
Line 15: | Line 12: |
====================================== |
{{{ |
Line 21: | Line 17: |
{{{ | |
Line 23: | Line 18: |
}}} | mlist.setMemberPassword(addr, newpasswd) mlist.Save() |
Line 25: | Line 21: |
{{{ mlist.setMemberPassword(addr, newpasswd) }}} {{{ mlist.Save() }}} {{{ |
|
Line 38: | Line 22: |
}}} {{{ |
|
Line 45: | Line 25: |
======================================== | 3) Create the following small shell script, named "change.userpw" and make it executable (`chmod 700 change.userpw`): |
Line 47: | Line 28: |
3) Create the following small shell script, named "change.userpw" and make it executable (chmod 700 change.userpw): ======================================== |
{{{ |
Line 55: | Line 31: |
if [[../$# -ne 2|$# -ne 2]]; then | if [ $# -ne 2 ]; then |
Line 57: | Line 33: |
{{{ | |
Line 59: | Line 34: |
}}} {{{ |
|
Line 64: | Line 35: |
}}} |
|
Line 67: | Line 36: |
{{{ |
|
Line 70: | Line 37: |
}}} {{{ |
|
Line 75: | Line 38: |
}}} |
|
Line 88: | Line 49: |
{{{ |
|
Line 91: | Line 50: |
}}} {{{ |
|
Line 96: | Line 51: |
}}} | |
Line 102: | Line 56: |
======================================= | }}} |
Line 104: | Line 58: |
4) Run the shell script to change all subscriber passwords | 4) Run the shell script to change all subscriber passwords in a specified list, eg: |
Line 106: | Line 60: |
in a specified list, eg: | {{{ change.userpw mylist foobar }}} |
Line 108: | Line 64: |
change.userpw mylist foobar | will change the password for all subscribers in list "mylist" to foobar. |
Line 110: | Line 66: |
will change the password for all subscribers in list "mylist" | 5) Check your work and check the status of the database files for the list. You should do a `check_db mylist` to see if you get any complaints (you should not). You should also do a dumpdb on the list's database file and take a look at it. You will find that all subscriber passwords in the database are what you specified for the shell script (if things worked). For example: |
Line 112: | Line 68: |
to foobar. 5) Check your work and check the status of the database files for the list. You should do a "check_db mylist" to see if you get any complaints (you should not). You should also do a dumpdb on the list's database file and take a look at it. You will find that all subscriber passwords in the database are what you specified for the shell script (if things worked). For example: |
{{{ |
Line 133: | Line 77: |
}}} | |
Line 136: | Line 81: |
{{{ | |
Line 137: | Line 83: |
}}} | |
Line 138: | Line 85: |
and so on through all of your subscribers for that list. If all | and so on through all of your subscribers for that list. If all of the passwords are "foobar" then things worked. |
Line 140: | Line 87: |
of the passwords are "foobar" then things worked. | Converted from the Mailman FAQ Wizard |
Line 142: | Line 89: |
''Last changed on Mon Jan 6 20:25:24 2003 by'' Jeff Earickson <<Color2(Converted from the Mailman FAQ Wizard, col=darkgreen)>>This is one of many [[../Frequently Asked Questions|Frequently Asked Questions]]. |
This is one of many [[../Frequently Asked Questions|Frequently Asked Questions]]. |
3.16. How do I assign a single password to all subscribers in a list?
This scripting trick works for 2.x versions of Mailman, and relies on bin/withlist to work.
1) Become the "mailman" user, eg su - mailman.
2) Put the following small file "changeuserpw.py" in the bin subdirectory, making sure that ~/bin is in user mailman's default path, so the file can be found and used:
from Mailman.Errors import NotAMemberError def changeuserpw(mlist, addr, newpasswd): try: mlist.setMemberPassword(addr, newpasswd) mlist.Save() except NotAMemberError: print 'No address matched:', addr
3) Create the following small shell script, named "change.userpw" and make it executable (chmod 700 change.userpw):
if [ $# -ne 2 ]; then print "Usage is: $0 list password" exit 1 else list=$1 passwd=$2 fi #---get the list members list_members $list > /tmp/$list.members #---change the user passwords for member in `cat /tmp/$list.members` do print "==== $member" withlist -l -r changeuserpw $list $member $passwd done rm /tmp/$list.members
4) Run the shell script to change all subscriber passwords in a specified list, eg:
change.userpw mylist foobar
will change the password for all subscribers in list "mylist" to foobar.
5) Check your work and check the status of the database files for the list. You should do a check_db mylist to see if you get any complaints (you should not). You should also do a dumpdb on the list's database file and take a look at it. You will find that all subscriber passwords in the database are what you specified for the shell script (if things worked). For example:
cd /web/data/mailman/lists/mylist ls -l config.* dumpdb config.pck > /tmp/mylist.dump vi /tmp/mylist.dump
And then look for something like:
'passwords': { 'joeblow@somewhere.com': 'foobar',
and so on through all of your subscribers for that list. If all of the passwords are "foobar" then things worked.
Converted from the Mailman FAQ Wizard
This is one of many Frequently Asked Questions.