Inconsistency in application of "domain name in new usernames" settings

This is about the two settings "Include domain name in usernames" and "Domain name style in username" from "System Settings / Virtualmin Configuration / Default for new domains".

Changes made to the former of those settings are immediately applied, also to existing domains. The latter though seems to be applied only to really new domains. As in, when I change it, and create a new email user in an existing domain, the change is not applied.

For one, this appears to be a somewhat confusing inconsistency in terms of when those settings are applied, and then, I'm just now trying to figure out how I can change the latter of those settings for existing domains, in case I change my mind and would like new email users for an existing domain be named "user.domainpart" instead of "user%domainpart".

Status: 
Closed (fixed)

Comments

Actually, both of those should apply to all new or existing domains immediately. However, once a user has been created he will remain in the selected format unless renamed ..

Yes, I agree about the existing user... But when I tested it, I created a new email user in an existing domain, and the naming scheme as it was before I edited it was applied... As if it was somehow fixed for the existing domain. Is that possible? Or should I test it again, maybe I missed something.

Try it again .. that shouldn't happen.

Also, what was the exact incorrect username (and what did you expect it to be) ?

I tried it again:

I set Domain name style in username to Username or first part of domain. Created a new domain "test5.tianet.de". Under that, an email user "test1". That user correctly became "test1%test5".

Then I changed Domain name style to Full domain name and created an email user "test2".

I would have expected that user to become "test2%test5.tianet.de", but it still became "test2%test5".

When I now, with the Domain name style change done, create a new domain, and an email user under that, it gets named correctly.

Ok, I forgot that the "domain name style" does get saved for existing domains, indirectly.

You can change this on the "Edit Virtual Server" page with the "Mailbox name prefix" field. However, it is only editable if the domain doesn't have any users yet .. otherwise, it is fixed.

Okidoki, I see it now. Thanks for clarifying!

Anyway, this behavior seems a little bit strange to me. What if I decide I'd like to change the auto-naming scheme for future email users... Then I can't change the suffix (it's reading "suffix" here for me, not "prefix") field anymore, unless I delete all existing users? I somehow find this a bit of a "harsh commitment" I have to make before setting up the first email user. :)

The reason is that the suffix or prefix is used to work out which users belong to the domain, so if it was changed while users exist that connection would be lost.

Okay, that's a good point.

Maybe, for a future improvement, it'd be nice to use a "mapping list" to tell which user belongs to which domain, instead of a naming scheme with unchangeable pre/suffix.

That would be an option .. but in general I want virtualmin to be able to determine the connection automatically, rather than using a separate database that would break if users were manually added or modified.

Sorry if there maybe was a misunderstanding: I would not want to be able to add/modify users manually, but just be able to modify the pre/suffix some time after users have been created.

So my suggestion would just be to use a "mapping list" between users and domains instead of a fixed naming scheme. Under VMin's control of course. That way the *fix could be changed, and existing users still attributed to their domain.

Yes, I see what you mean ... I would just prefer VIrtualmin to not need to maintain a separate mapping database.

I will look into adding support for changing the prefix/suffix somehow, and updating all existing users at the same time. This should be a sub-problem of renaming a domain, which is already possible.

I agree with trying to avoid another database, while keeping the option to change the *fix later would, to me personally, be rather important. :) But yeah, I'd say renaming existing users would be quite a viable option too to accomplish this.

I'm pondering all this because I'm making plans to migrate a web site that's currently hosted on a Windows system, with about 50 email users, which have a certain naming scheme for login (user@fulldomain.de). I know that having an @ in the username is problematic for Postfix, so I'm pondering to change that and inform the users that on day X their login name will change. And for this purpose I'd like to be somewhat open concerning naming scheme... As in, I decide to go with one, create like 30 users, and then notice "hmm, no, the other scheme might have been better". Having to delete and re-create those 30 again might be awkward. :)

Okay, there are the "batch creation" functions. Those will probably help at this point too.

Actually, virtualmin supports user@domain formats just fine, even with Postfix.

Yep I know it does... It just needs to create an additional system user or something, if I remember correctly, right? The documentation popup said something about that using that format is not recommended with Postfix.

Here, I looked up the corresponding line in the docu: "The username@domain option is not recommended unless you are migrating users from another system that already uses it. The Postfix mail server has problems with SMTP authentication by users with an @ in the username, and requires that an extra Unix user be created for each mailbox for mail delivery to work."

Anyway, thanks for all the effort you put into this issue here! I really don't want to keep you from working on serious issues! :)

Yes, to support this format Virtualmin has to create an extra Unix user without an @ in the name, to work around Postfix issues. However, this works fine, and is used by a lot of customers who want to avoid having to explain to users why their email address and username differ.

Okay, thanks again! I understand and ponder keeping the format then.

Two little follow-up things I just noticed:

1) Edit virtual server / Configurable settings always says "Mailbox name suffix" in the first line, even if it is configured to be a prefix, like "domain.user". Just a cosmetic thing of course.

2) Unlike the suffix text itself, I can change the "Format for usernames that include domain" in the templates, Mail for domain. Just wondering if that might constitute a problem, when I change that after users have been created? Will VMin still "remember" which users were created when the domain was a prefix, and for which it was a suffix, and what separator character was used?

  1. Oh, you are right .. I got suffix and prefix mixed up. Will fix in the next release. Thanks for pointing this out!

  2. It is fine to change this - virtualmin can still correctly associate users with the domain.

Great!

Again a few thumbs up for Virtualmin! I've been playing with some more options yesterday and am more and more thrilled about the sheer amount of features here.

Virtualmin 3.82 will allow the prefix / suffix to be changed independently on the "Change Domain Name" page.

Automatically closed -- issue fixed for 2 weeks with no activity.