Hello there,
Let's say we would like to migrate from a MyVestaCP server to another, all the mail accounts under a mail domain.
At the first old server, we have several accounts in use in a mail domain.
At the second new server, we create the mail domain, but not the accounts.
¿Is there any tool provided for this?
¿Its good idea to use doveadm or rsync instead of imapsync (we have not accounts at the second server)?
Thanks!
Migrating mail accounts to another MyVestaCP server
Hi again, just for anyone looking for this.
First, create mail domains & accounts, at the local new Server, with p.e. random passwords. In case large amount of accounts, use:
Get the accounts names and use Bash p.e.:
Then Rsync:
Then just copy settings from and adjust (like inside the passwd file).
Take a look at permissions, from remote folders and set the same at the local ones.
This way is possible to migrate accounts with same credentials.
(Not sure if necessary to clean dovecot cache files).
First, create mail domains & accounts, at the local new Server, with p.e. random passwords. In case large amount of accounts, use:
Code: Select all
/usr/local/vesta/bin/v-list-mail-accounts
Code: Select all
#!/bin/bash
ACCOUNTS=(
account1
account2
account3
)
gen_pass() {
tr -dc 'A-Za-z0-9' </dev/urandom | head -c 8
}
for ACCOUNT in "${ACCOUNTS[@]}"; do
PASSWORD=$(gen_pass)
/usr/local/vesta/bin/v-add-mail-account [domain] "$ACCOUNT" "$PASSWORD"
echo "Account created: $ACCOUNT@[domain]"
done
Code: Select all
sudo -u [local-vesta-user] rsync -avzt --progress -e "ssh -p [port]" [remote-vesta-user]@[remote-server]:/home/[remote-vesta-user]/mail/[domain]/ /home/[local-vesta-user]/mail/[domain]
sudo chown [local-vesta-user]:mail -R /home/[local-vesta-user]/mail/[domain]
Code: Select all
/home/[remote-vesta-user]/conf/mail/[domain]Take a look at permissions, from remote folders and set the same at the local ones.
This way is possible to migrate accounts with same credentials.
(Not sure if necessary to clean dovecot cache files).
