Shell that moves admins to moderators, change admin and moderator passwd
Hello,
not sure anyone will have use for this, but I'm submitting it just in case.
I had to do the following on 100+ lists:
for each list:
the administrator(s) becomes moderator(s) a new administrator is added change administrator's password change moderator's password
the list of affected lists is in a file named reglists /home/cat/wk is a directory where I store previous admins lists /home/cat/cfg is a directory where I build the new config file to run on the lists
for i in cat /home/cat/reglists
do
echo $i
# create list of administrators
/usr/sbin/list_admins $i | awk -F: '{print $3;}' | sed -e "s/,/\n/g" |sed
-e
"s/^ //" > /home/cat/wk/$i
# create new configfile echo "# -*- python -*-" > cfg/$i echo "# -*- coding: us-ascii -*-" >>cfg/$i
# new moderators
MOD="moderator = ["
for j in cat wk/$i; do MOD="$MOD'$j',"; done
echo $MOD |sed -se "s/,$/]/" >>cfg/$i
# new administrator echo "owner = ['newadmin@yourmom.com']" >> cfg/$i
# new passwords echo "import sha" >> cfg/$i echo "mlist.password = sha.new('newadminpasswde').hexdigest()" >> cfg/$i echo "mlist.mod_password = sha.new('newmoderatorpasswd').hexdigest()" >> cfg/$i
# apply config file /usr/lib/mailman/bin/config_list -i cfg/$i $i
done
thanks to Mark for helping me figuring out the change of passwords in the config file
-- Cat Burning Man Sysadmin Team
participants (1)
-
Cat