Wrong e-mail account with identical username on different domains

So, I have a user called "jon" for domain1.com and I have another user called "jon" for domain2.com , however, when logging into webmail.domain1.com with username "jon" I actually get to the e-mail account for "jon" on domain2.com instead.

I was a little unsure if I should post this as a bugreport, but I actually have two other users on domain1.com which also has a user at domain3.com and domain4.com , exactly the same happens to these, only way to login correctly is by username.domain , but when going to webmail.domain1.com , aren't you suppose to have it narrowed down to that specific domain?



Do all these users have the same password? Normally, this kind of situation would be impossible, as jon@domain2 wouldn't have the same password as jon@domain2.

Also, do either of these users have just jon as their Unix username?

Yes, they have the same password, and i have in my /etc/passwd ; jon.domain1 and just jon <- which is the domain2 user.

EDIT: I have this for 3 other users, because they are tied to domain1, but also have their own domain. This will probably be changed when i pay for the pro license and get the reseller thing instead, but i'd really like to know if there's a solution, shouldn't users be tied to a domain even if the domain is created with a custom/specified username?

Ok, I see now .. the reason this happens is the the Usermin webmail UI looks for a user with the exact same name as the one you entered first. Since you entered "joe" and there is a user with the Unix login "joe", it will be used.

The fix is to make sure all your users have Unix usernames that include the domain, like joe.domain1 and joe.domain2. This can be set at System Settings -> Module Config ->Defaults for new domains -> Include domain name in usernames? .. it should be set to Always.

You may need to delete and re-create the user whose Unix name is just "joe" to apply this.

Ok, thanks for clearing this up, sad thing is i have alot of sub-servers under each of these users:/ But better now than later I guess.

EDIT: Include domain name in username is already set to "Always".

Another work-around is to manually rename the user, at Webmin -> System -> Users and Groups -> joe.

Ok thanks:) I am concerned though, because what you told me to enabled was already enabled.

Did you ever change this setting at some point in the past?

I have been very strict with not changing anything that I am unsure about, so I don't recall and I don't think I have touched that option.

Ok .. so if you create a new mailbox in domain2 with a name that isn't in use anywhere else (say testing123), does his Unix username get set to testing123 ?

I just tried setting up the site from a fresh slate.

  • Include domain name in usernames? is set to Always
  • I set up: domain.com
  • and under Administration username i choose Custom username: jon

Users and Groups shows only jon as username, and not jon.domain

I also experienced that if i went into Users and Groups to change the username from jon to jon.domain as suggested, the home folder also got changed and there were some paths that didn't get updated, I think some apps were still looking in /home/jon and not /home/jon.domain/

Oh, I see now .. I didn't realize that one of these users was actually a domain owner, who won't get the domain name appended. So if there is a user named jon in some other domain, the domain owner jon will be matched first.

There isn't really a good solution for this, sorry .. apart from having your users always login with their email addresses, which are unique and un-ambiguous.

So the only solution would be to create site's per default and add users as normal I guess? Not using the domain owner... I remember on an older server I was handling using roundcube, i had it automatically append the domain name to the user login, which worked excellent, and this way you separate users per domains.

Yes, you could choose not to use the domain owner account for email at all .. or have it always set to the full or partial domain name.