[Mailman-Users] Migrating Mailman to New Server (Same Domain)

Jeffrey Rolland jrolland194 at gmail.com
Mon Jun 11 07:36:30 EDT 2018

I tried using your script. The tar_list.sh script works fine. But, for the
untar_list.sh script, I had two fairly big problems.

1) the mailman user account did not have a home director or shell; I fixed
those problems handily.

2) I got a ton of permission/owner errors trying to untar the archives. The
private archives on the new server appeared to have been owned by root,
while the public archives appeared to be owned by www.-data; neither
untar-ed well with the script being owned by mailman.

Can you help? I'd really like to migrate my server today, and this is my
last task before switching over the firewall exceptions to the new server's
inside-NAT IP address.

Thanks much in advance.

Jeffrey Rolland
<jrolland194 at gmail.com>

"The weed of crime bears bitter fruit; crime does NOT pay! The Shadow
 - The Shadow, _The Shadow_ (1994)

Version: 3.1
GM d-- s:+ a+ C++>$ UL+>$
P? L+++>+++++$ E--- W+++>$ N+++>+++$ o? K--? !w--- !O---- !M- !V-- PS++
PE- Y? PGP+++ t+++ 5? X+ R+>$ tv++ !b DI+++>+++++ !D G+ e++++$ h+ r--

FWIW, I've done two complete migrations of a number of mailman (v2)
lists as I've changed servers over the past few years. A couple of
scripts I've used have worked perfectly in every case. In every
migration, the basic Mailman installation is set up and running on the
new server. Mailman versions, as long as we're talking about v2.x.x,
are a no-nevermind.

The first, which runs on the old server is called tar_list.sh, is kept
in /usr/local/sbin and is run as root:

    if [ "$1" = "" ]; then
    	    echo 'Usage: tar_list.sh <listname>'

    if [ ! -e /var/lib/mailman/lists/$1 ]; then
    	    echo "$1: No such list!"

    mkdir /tmp/$1
    cd /var/lib/mailman/lists/

    echo Creating $1_list.tar.gz ....
    tar -czvf $1_list.tar.gz $1
    mv $1_list.tar.gz /tmp/$1

    cd /var/lib/mailman/archives/private/

    echo Creating $1_archive.tar.gz ....
    tar -czvf $1_archive.tar.gz $1
    mv  $1_archive.tar.gz /tmp/$1

    echo Creating $1_archive_mbox.tar.gz ....
    tar -czvf $1_archive_mbox.tar.gz $1.mbox
    mv $1_archive_mbox.tar.gz /tmp/$1

    if [ -L /var/lib/mailman/archives/public/$1 ]; then
    	    touch /tmp/$1/$1_archive_is_public

The second script, on the new server, lives in ~mailman/bin and is run
as the mailman user (which, on my server, has a real, usable shell):

    if [ "$2" = "" ]; then
            echo 'Usage: untar_list.sh <server> <listname>'

    cd ~/tmp/
    echo "Give root password on remote system ..."
    scp root@$1:/tmp/$2/* .
    cd /var/lib/mailman/lists/

    echo ""
    echo "Creating list $2 ..."
    tar -xzvpf ~/tmp/$2_list.tar.gz

    cd /var/lib/mailman/archives/private/

    echo ""
    echo "Creating archive for $2 ..."
    tar --same-owner -xzvpf ~/tmp/$2_archive.tar.gz

    echo "Creating archive mbox for $1 ..."
    tar --same-owner -xzvpf ~/tmp/$2_archive_mbox.tar.gz

    if [ -e ~/tmp/$2_archive_is_public ]; then
    	    ln -s /var/lib/mailman/archives/private/$2

    echo "If no errors, delete files in ~/tmp and delete /tmp/$2
directory on remote system"

This does require (and this may be a show-stopper for some) that the
mailman user on the new system be able to ssh to the old server as
root. I'm sure there's an easy workaround for this, but since I've
always has full root access to my servers and run connections between
servers via encrypted VPNs, it's been simply a matter of modifying the
sshd_config file to allow this

More information about the Mailman-Users mailing list