Set maximum length for automatically generated virtual server usernames

Despite there is an option to set custom username when creating a virtual server, the end-users very often leave it be generated automatically, which leads to various confusions in some cases, especially if the domain name is really long one. In particular, we witnessed number of confusions when the end users were confusing the virtual server usernames with the database usernames.

This problem is becoming even more critical with MySQL 5.6 enforcing the maximum number of 16 characters for the database usernames, here is the quote from https://dev.mysql.com/doc/refman/5.6/en/user-names.html:

MySQL user names can be up to 16 characters long.

So the question is why we can't set the maximum number of characters for the virtual server usernames in Virtualmin's main configuration when we definitely can do for "Length of randomly generated password"?

Status: 
Active

Comments

That's a good idea - I will add a config option for this in the next release.

Status: Active » Fixed
Status: Closed (fixed) » Active

Opening an old feature request again as:

(1) It is not clear where to set the limitation; (2) Maybe it is a good idea to leave setting this kind of limitation to users, but then I see really no use case when it would be ok for the usernames be longer than 16 characters - such cases would hit the error anyway.

I've just tested this by creating a virtual server with really long domain name and it has given:

Creating MySQL database dslkfjsdklfjlsdkjflsdkflksdjflsdjflkdsdfjklsldjflsdjfddlsjf_dslkfjsdklfjlsdkjflsdkflksdjflsdjflkdsdfjklsldjflsdjfddlsjf ..
.. MySQL database failed! : SQL create database `dslkfjsdklfjlsdkjflsdkflksdjflsdjflkdsdfjklsldjflsdjfddlsjf_dslkfjsdklfjlsdkjflsdkflksdjflsdjflkdsdfjklsldjflsdjfddlsjf` failed : Incorrect database name 'dslkfjsdklfjlsdkjflsdkflksdjflsdjflkdsdfjklsldjflsdjfddlsjf_dslkfjsdklfjlsdkjflsdkflksdjflsdjflkdsdfjkls' at /usr/libexec/webmin/web-lib-funcs.pl line 1433.

Please hardset the 16 character limitation not to confuse the end-users.

The current release of Virtualmin determines the max MySQL username length automatically. However, there is no check on the default DB name length, which is apparently only 64 characters. I'll handle this better in the next release.