Merging three Webmins/Virtualmins

Webmins, OS and Virtualmins Details can be seen on below snapshot

Hi Everyone

I have three virtualmins running on three different VPS. I want to combine them into one.

I have currently setup a new Webmin/virtualmin with Domain abc,com

That created /home/abc directory. abc database, abc user.

My other two VPS having domains abc,au and abc,xyz

These two webmin vps having same /home/abc directory, database abc, user abc. It is because suffix of domains are same

I have taken the backup abc,au for example by following command

sudo virtualmin backup-domain --domain abc,au --all-features --newformat --dest /root/abc,au/ --mkdir

Now i can restore it on VPS (Webmin) that is running abc.com having same name of user, home directory and database. But i have doubt It will mess up the abc.com

I have command to restore

virtualmin restore-domain --source /root/abc,au --domain abc,au --all-features

But i am afraid to restore it.

Please help me how to handle this situation

i don’t use dot here above in post, abcdotau, abcdotcom,abcdotxyz. Actaully forum is cosnidering it link and prompt me new user can post only two links. So sorry for that in advance

If you wrap domain names in backticks (`), they won’t become links. Also, I recommend you use domains that will not resolve, e.g. domain.tld or example.tld, if you don’t want to mention your real names.

When you restore, you can choose to re-allocate names to avoid a clash.

Thankyou for reply, is it possible to handle this via command line?

sudo virtualmin restore-domain --source /root/abc,au --domain abc.au --all-features --new-home /home/abc_au --db-name abc_au --unix-user abc_au

can someone let me know above command is valid? while restoring in above command i can specify usernamem database and home directory name. This command is generated by chatgpt, So i am not sure its valid?

If above command is valid, it can help to avoid clash

I suppose it’s what you are looking for ( https://www.virtualmin.com/docs/development/api-programs/restore-domain/#command-line-help):

Still that if you want 3 platform on the same server you will have to create 3 Virtual Server, so the Home will be different for each of them.

Or I missunderstood and you have 3 Times the same Sites. And simply want to merge the DB ?

Actually 3 different webmins on different VPS are running 3 different sites abc,au abc,com abc,xyz

Vitualmin used prefix abc on all webmins to create DB, home directory and username. Help command does not have such parameters what you pointed in above link to define DB,homedirectory and user.

Normally what should be the procedure to restore such domains?

@zohaib09 You should go to System Settings ⇾ Virtualmin Configuration: Defaults for new domains page and change Domain name style in username option to Full domain name.

@Jamie, are you still not in favor of making it the default? Having a Unix username that matches the domain name is much cleaner than having a random username for the first part of the domain. It especially gets messy when sub1.example.tld is used as the top-level domain, creating a sub1 username, which is fairly obscure on its own.

Hi brother, thankou for your reply

After doing setting you wrote here on a VPS/webmin that have a domain abc.com. But it will be applicable for new domains

On this VPS i want to restore abc.au for example that was backed-up with default settings (means having abc DB. Home Directory and username). So when i will try to restore, will it not be clashed? because i assumed that the abc,au had prefix abc for DB, username etc, and right now the domain abc,com have same prefix for DB, username etc.

I think this kind of restore may be tricky to accomplish while maintaining distinct usernames; you could end up with Unix usernames like abc, abc.org, abc.net, etc., which can be undesirable.

However, you could try to work around this by first setting the Domain name style in username option to its default setting. Then, create a non-existent domain like abc.local to generate the Unix username abc. After that, change the Domain name style in username option to use the full domain name in the username. Finally, proceed with the restore, re-allocating users and groups as Joe mentioned earlier.

This may actually work!

I’d rather not, because this would lead to unnecessarily long usernames. If admins really want the full domain name in the username, we offer the user@domain.com format.

Alright! But we already have the full domain name format configured by default for additional users added to the domain. Why would it hurt to also use the full domain name for the domain owner user?

Consider the following examples.

Current default:

ubuntu24-pro:x:1002:1002::/home/ubuntu24-pro:/bin/bash
user1@ubuntu24-pro.virtualmin.dev:x:1006:1002::/home/ubuntu24-pro/homes/user1:/bin/false
ssh-user1@ubuntu24-pro.virtualmin.dev:x:1007:1002::/home/ubuntu24-pro/homes/ssh-user1:/bin/bash

Suggested default:

ubuntu24-pro.virtualmin.dev:x:1011:1006::/home/ubuntu24-pro.virtualmin.dev:/bin/bash
user1@ubuntu24-pro.virtualmin.dev:x:1012:1006::/home/ubuntu24-pro.virtualmin.dev/homes/user1:/bin/false
ssh-user1@ubuntu24-pro.virtualmin.dev:x:1013:1006::/home/ubuntu24-pro.virtualmin.dev/homes/ssh-user1:/bin/bash

Yes, the suggested output is slightly longer, but it’s much clearer and more straightforward for understanding the connection between users and home directories, either by navigating to the /home directory or checking the passwd file.

Things get even more confusing when a top-level subdomain is created. By default, Virtualmin uses the first part of the subdomain, like sub1, as the username and home directory. This becomes problematic when multiple domains share similar subdomain names, leading to clutter in /home with directories like sub1 for domain1.tld and sub1.domain2.tld. Instead, it should consistently use sub1.domain.tld, sub2.domain.tld, or domain.tld (not just domain).

It would also reduce chances of username clashes on restore.

According to me in this specific case.

  1. Simply backup every DB individually.

  2. On the new server you create 3 New DB (With the name you want)

  3. Then you restore individually each DB

Same for the “Home”, You create individually 3 virtual server and restore each independently of other.

If user and DB had the same name on the 3 sites, you will have to change it to avoid conflict.

Sorry if I misunderstood.

Procedure which i followed

  1. Virtualmin Ssytetem settings → virtualmin configuration → default for new domains → Domain Name style in username → Full Domain Name

  2. Virtualmin → Create Virtual Server → abc,au → create Server (This created user abc,au and DB abc,au)

  3. Virtualmin → abc,au → Backup and Restore → Restore Virtual Server → Local File and Directory → /root/abc,au

  4. Click on other restore option → Reallocate user and group names -->Yes → show what will be restored

  5. Restore now

Re-loading MariaDB database abc …
… a database with the same name already exists!

Restarting mail server …
… done
… failed! See the progress output above for the reason why.

Reason is database name is now clashing i think. Because i am restoring abc,au on webmin that hosts abc,com. Both servers used prefix to create DB.

Positive thing is It restore data directory inside abc,au (Not used prefix). User directory issue resolved. We have only thing is DB clash. how to avoid this?

Any suggestion please

Thats not needed, restore should do the creation if its not there.

The database prefix should be abc_au, that how it is on my system that shouldn’t clash with abc_com

I’ve had three domains on my system with mydomain, ie mydomain.com mydomain.net and mydomain.com.au. and no clashes with restore.

Yes i assumed it also, but if i do not create virtual server, it overlaps/clashed with existing username abc. As already mentioned live server have site abc,com and i am restoring on it abc,au. Both domains used prefix abc for user and DB.

When i created virtual server with procedure stated above, it created a user with full domain name, and that error username clashed gone.

Now only DB have name have issue

How did you manage that :slight_smile: Somehow on the original creation it didn’t use the _au and _com

Ok, I see how as it was made on separate servers and the first one leave off the _com

Bro, i think its because you setup your webmin in this way. Means your webmin was configured with this option in intial phase

  1. Virtualmin Ssytetem settings → virtualmin configuration → default for new domains → Domain Name style in username → Full Domain Name (that always create db, user with abc_au abc_com etc)

I have been in situation in which three servers are separated right now and above option was not configured. Now i have to merge all three webmins that are runng abc,au abc,com, abc,xyz All have used prefix for username and DB.

If all my servers were configured above option in configuration phase then your point would be valid for me.

We have resolved username clashed issue, now only DB name conflicts

@Ilia @Joe

Yep, goodluck, I’m sure you will work it out.

Wait, where do we have this as the default? That shouldn’t be the case … but it’s an option if users want it.