I believe that I have come up with a workaround (though I haven’t fully tested an account with a client yet, telnet tests work). It’s a bit of a pain though.
(These commands imply that you have done “sudo -i”, if not you can put sudo in front of most of them. They also imply that the domain has been made, in the example “cheese.com” and that the user you want to create is 1234@cheese.com, adjust accordingly.)
First, create a temporary mail user that does not start with a number (this is for easily copying the folder structure and settings, it can be deleted when we are done) either with the web interface or:
virtualmin create-user --domain cheese.com --user emptyuser --random-pass --shell /dev/null
Next determine the group (and directory and shell) that this temporary user went into:
tail -1 /etc/passwd
Example (the group here is 1258, the directory is /home/cheese.com/homes/emptyuser and the shell is /dev/null):
emptyuser@cheese.com:x:1778:1258::/home/cheese.com/homes/emptyuser:/dev/null
Now create your new user at the command line using the same group and shell and similar “part before the @” directory:
useradd 1234@cheese.com -g 1258 -d /home/cheese.com/homes/1234 -s /dev/null
(Don’t worry when it says “useradd: Warning: missing or non-executable shell ‘/dev/null’”)
And copy the structure from your empty user to it (this will make the 1234 directory and populate it):
cp -r /home/cheese.com/homes/emptyuser /home/cheese.com/homes/1234
Check the ownership of the emptyuser folder:
ls -alt /home/cheese.com/homes/emptyuser
Example:
total 16
drwx------ 9 emptyuser@cheese.com cheese.com 4096 Aug 8 16:06 Maildir
(etc)
And change your copied version to match your user:
chown -R 1234@cheese.com:cheese.com /home/cheese.com/homes/1234
(Note that the email address and group are separated by a colon in the command but a space in the file, -R will do this recursively through your new user’s new folders.)
Now add your user to /etc/postfix/virtual in the same format as the others and save. For example:
tail -1 /etc/postfix/virtual
emptyuser@cheese.com emptyuser\@cheese.com
Note the “\
” on the second instance of the mail user lines (it’s not on the domain user lines, don’t be confused, you want it). I used nano, but your editor is your choice:
nano /etc/postfix/virtual
So ended up with:
1234@cheese.com 1234\@cheese.com
(I am not sure if it matters but I used tab to separate the two since the file’s spacing implied that for the others.)
Now update postmap and restart postfix and dovecot:
postmap /etc/postfix/virtual
systemctl reload postfix
systemctl reload dovecot
Now go into your virtualmin and navigate to the domain and Edit Users. Click the user, set the password and mail permissions and quota (if needed) and uncheck “Login temporarily disabled”, and Save.
You should now be able to delete your emptyuser if desired, either with the web interface or:
virtualmin delete-user --domain cheese.com --user emptyuser --random-pass --shell /dev/null
Does anyone know if this misses anything that Virtualmin does with non-number-starts-with-a-number email accounts?
If I am right that this works and does everything then it would seem that all-number or starts-with-a-number email addresses do not cause problems in Linux postfix or dovecot and are not an issue for email. Is there then some way that I can submit a feature request that Virtualmin deal with them natively? This seems like a lot of steps if Virtualmin is the only thing that legitimately does not like these.