How do I restore one mail user from backup?

Guys,

How do I restore 1 mail user from backup?

The web interface doesn't allow me to restore a single user, can I do this from the command line?

Thanks! -- Craig

Status: 
Active

Comments

I thought maybe something like this would work but it appears the --only-missing flag relates to the actual domain name.

virtualmin restore-domain --source /tmp/backup-files/backup/domain.com.tar.gz --test --domain domain.com --feature mail --only-missing

How do you recommend / what is the best way to restore a single email user account?

Thanks!
-- Craig

Howdy -- it's unfortunately not possible to restore just one user.

If you're just looking to restore some files for that one user, you could always manually open that backup archive, and then copy the files in question to the user's account.

The actual email files aren't a problem since we use Bacula and backup /home/domain/homes directly. I was hoping to be able to restore the actual email account/password/aliases/spam/vacation settings for that user.

I'm not sure what's involved but it would basically be "creating" a new account but passing the create info from the backup file since all the info is there as we can restore all users. It wold be a good feature.

Thanks for the speedy response!
-- Craig

For those of you with a similar need, here's what I did to accomplish restoring one email user.

1) Create the email user in Virtualmin
2) Restore the email files from backup (in our case from Bacula) to /home/domain/homes/user
3) Set/Reset the password for the user so they can login

-- Craig

Ok, this did not work... Everything is there and user mail directory has the correct permissions but the user cannot see email in the Inbox (I verified by logging into Usermin as the user). BUT I can see the Inbox emails when viewing through Virtualmin.

I verified the ../.usermin/mailbox/inbox.imap file is correct

# cat .usermin/mailbox/inbox.imap
user=*
pass=123456

It acts like its permission related but everything iin ../home/user is set to user:domain permissions. Is there anything else I can check?

-- Craig

What error do you see in /var/log/maillog when this problem occurs?

I don't see any errors, email are there but the user just cant see them...

I have the same issue, I just copied the email messages from a backup to the Maildir/cur folder of one user (which was empty) and see nothing in Usermin inbox. The files permission and owner are correct.

I have a suspicion that there's a permissions problem of some sort; the files would need to be owned by the email user, and not the Virtual Server owner.

If you go into "/home/DOMAIN/homes/USERNAME/Maildir/cur", what output do you receive if you type this command:

ls -la

I got it!! Delete the files .../homes/user/Maildir/dovecot* then restart dovecot. Problem fixed!

Thanks! -- Craig

Aha, so it's a Dovecot index file problem; and those would indeed be re-created if they were deleted.

I'm glad you got it figured out!

I copied the files with the "cp -p" command so they have the same owner/permission as those contained in the backup.

I confirm that deleting all Maildir/dovecot* files and restarting dovecot solves the problem. Thanks Craig!