Change login name from user.domain to user@domain for already created users

15 posts / 0 new
Last post
#1 Sat, 09/08/2018 - 13:53

Change login name from user.domain to user@domain for already created users

Hi, i recently change format user name from user.domain to user@domain in server default template and is great for new accounts, but i have a lot of accounts already created. How can i change format for that users? Is there a way i can login with both formats? (only for some time to have softer migration)


Mon, 09/10/2018 - 12:50

Can someone help me with this?

Mon, 09/10/2018 - 13:18


Sorry, there isn't a way to change the username for existing users.

The only way would be to delete and re-add the user.


Mon, 09/10/2018 - 13:22 (Reply to #3)


And is there a way to recreate existing user without deleting setting and mailbox?

Mon, 09/10/2018 - 13:27

You could always make a backup of the Virtual Server, and restore it... that would be one way to do what you're after without losing your data.

Fri, 09/14/2018 - 06:16 (Reply to #5)

I think could be great some command to achieve this. Backup and restore is complex process for production servers. You think i can suggest this for developing?

Fri, 09/14/2018 - 10:49

Yeah I hear you, it's not ideal... unfortunately, that isn't likely to change any time soon. It's fairly complex to change the username format of an existing user.

I can't say that feature won't ever exist, but it's extremely unlikely to happen this year.

The best I can offer for now is to wait for after hours, and then perform a backup/restore of your domains at that time.


Fri, 09/14/2018 - 15:22 (Reply to #7)

I understand. Actually, i have no problem with user.domain format i was using, problem for my users is new version of outlook 2016 is not supporting user.domain format, at least, without making some changes in registry that forces the use of autodiscover.xml values, that is not realistic for users. When you start configuring account in outlook, first you enter email, next enter password, then tries autoconfig (that fails, because first it tries guessmart, succesfuly finds mail server and tries to login with email address, ignoring autoconfig.xml values) and after that, outlook offers you to do manual configuration of account. But.... you can't modify user anymore, user is a label, that is email address. You only could change server adress, port, encryption, etc but not user for login. I suppose so outlook is widely used, more people will demand this function.

Fri, 09/14/2018 - 16:06

Thanks for your explanation of the issue!

I informed Joe about that to see what he thinks.

If not using the auto-config, is there any chance it'd be possible to manually enter the login details?

If Outlook is no longer supporting user.domain though, that is a bit of a pickle, so thanks for bringing that up.

Fri, 09/14/2018 - 16:50 (Reply to #9)

Me and some of my users have O365 plans so we have outlook updated to last version, recently, Outlook has changed wizard to add acounts to one "easier". I could send snapshots if you want in private message to better explain issue. I dont know if there is other way to change user name but i couldnt find a way. I asked in microsoft forums and i didnt get any help. Also, I dont know if this is temporary or definitive.

About not using autoconfig... you mean on server or on client side?

On client side i guess is not possible, at least, without editing windows registry... In first step you only enter email address and you can enable checkbox for manual configuration. But even with this checked, it tries autoconfig and after that you can change settings. User name is a label in both cases and not a textfield like in the past, and is only one. Before the changes, there were two textfields, one for incoming and other one for outgoing server user name.

In server side i have not tried (disabling autodiscover) but i dont think its going to work, because autoconfig first step is guessmart that not depends on autodiscover. it tries server address and configurations until it find one that works. For example, for address first tries "mail.domain" if it fails "domain" and if it works it tries different ports and encryption configurations. But... i will try just in case...

Fri, 09/14/2018 - 18:36
Joe's picture

Some of the defaults that are in the autoconfig.xml need updating, it assumes some stuff that is rarely true these days... I'll try to spend some time updating it to work more reliably in modern situations (like port 25 not being available at all, which is true of most consumer ISPs and even many business networks).

The default username format is changing in Virtualmin 7, which is coming in a couple of months I think. Mail is getting a huge overhaul all around (Ilia has been rebuilding Usermin mail to be awesome, and some of the configuration we've been using for years has become less reliable as common practices have changed and mail clients have started to "simplify" setup, by removing options). So, mail is a focus of my work for the next Virtualmin Config release.

In the meantime, though, it can be tricky to convert existing users...but it is possible, even without backup/restore. I don't know exactly what all needs to happen but I bet it can be scripted.

Certainly the following is needed:

  1. Create additional passwd/shadow entries for the user@domain name (keep the other name, too...the user@domain format doesn't work with all services, so both names must exist). The UID and GID and home, etc. should be identical to the original user.domain name.
  2. Tell Virtualmin about it...not sure how this is done. Probably a config option somewhere.

Actually, I think that's it. The home directory is always the same... there's always the second user name, and the home directory is specified in passwd, and UID is used for stuff like permission and ownership, so it probably just needs the extra user created and probably need to let Virtualmin know the user has that format.

Seems like this will actually be easy to script. I'll see what I can come up with (though it's probably gonna be a few days before I can look at it as Jamie's mostly offline right now so we're spread a little thinner than usual).


Check out the forum guidelines!

Sat, 09/15/2018 - 03:32 (Reply to #11)

Hi Joe, Its great to know about virtualmin 7 mail improvements, some autoconfiguration for Dovecot SNI certificates would be great! its not difficult to add entries manually, but i think will be better if virtualmin tries to have mail connection encrypted from the begining. Actually, i think using virtualmin's last version, i cloned a virtual server and some SNI entries were added in dovecot config files. But, entries were added in dovecot.conf instead of 10-ssl.conf file, and i think is better to add fullchain.cert (or ssl.everything) instead of ssl.cert so all email clients can validate letsencrypt certificate. Without CA some email client could have problems like gmail (Android).

About autoconfig and autodiscover xml, i have modified the files but im pretty sure default port for smtp was 587, and i dont remember have changed this in server template. So maybe is not that bad as you remember. I have modified server address because is mail.domain for IMAP and domian for smtp and added some values for enryption. But main problem with autodiscover is Outlook first tries guessmart, so it ignores user name in autodiscover.xml file.

About the script to change user name, Im happy to hear actually is not that difficult. I will do some research maybe i can help. I read in some other forum about some way to delete and recreate user without deleting config and home directory... but he didnt explain more. This could be possible?

Thank you

Sat, 10/13/2018 - 18:35

I would like to add to this, microsoft outlook is the most stupid program i have ever come across. i can get this working in thunderbird and windows 10 Mail, however, the EXACT settings i am using in those two programs absolutely will not work with Outlook (I have rechecked and re-enterred the correct information dozens of times all to no avail)

It is as if Microsoft have intentionally setup this program to F$kup using external email servers on purpose!!! (and to think i pay money for office 365 each month)

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

Tue, 11/13/2018 - 12:39
pixel_paul's picture
microsoft outlook is the most stupid program i have ever come across

But if you find yourself struggling then you can add an account the old way by going to 'Control Panel', click 'Mail', and then creating a profile where you'll get popped into the wizard....

Mon, 11/19/2018 - 13:22

Here is an Autoconfig xml I created last year that works fine for Outlook 2016, Office 365 and Outlook 2019. It adds TLS and assume for both servers.

<?xml version="1.0" encoding="utf-8" ?>
<Autodiscover xmlns="">
  <Response xmlns="">
Topic locked