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.

MailmanWiki: DOC/How do I assign a single password to all subscribers in a list? (last edited 2015-02-08 11:23:31 by JimTittsler)