Change automatich username algorithm

3 posts / 0 new
Last post
#1 Tue, 04/27/2010 - 11:12
websight

Change automatich username algorithm

We're currently migrating our hosting from Plesk to VirtualMin. In Plesk, we had a standard way of generating a username. VirtualMin also supports automatic username generation, but the algorithm behind it is a bit different from what we're used to. In order to keep everything as compatible as possible, I would like to change this algoritm. From what I can see, the function unixuser_name generates the username. It is safe to change this file, with the idea of future upgrades to the system? Is there another way to give this function a different implementation for our setup?

The same will have to be done to the automatic database names. We currently use the setup: domain_tld_subdomain, while VirtualMin uses subdomain_domain_tld. This will be less of a problem, but while I'm at it, I would like to change that too :)

Tue, 04/27/2010 - 11:56
andreychek

Howdy,

Any changes you make to the Webmin/Virtualmin code would be overwritten next time you upgrade... so that might not work as hoped :-)

However, there are some options to tweak how the usernames are created.

If you look in System Settings -> Server Templates -> Default -> Mail for Domain, you can set the username format using "Format for usernames that include domain".

Also, in System Settings -> Module Config -> Defaults for new domains, you may want to take a look at "Include domain name in usernames" and "Domain name style in username".

Also, you can tweak the database naming scheme by going into System Settings -> Server Templates -> Default -> MySQL Database, and tweaking "Default database name" and "Prefix for additional databases".

-Eric

Thu, 04/29/2010 - 02:14
websight

Yeah, I tried to implement our algorithm with those setting fields, but I'm actually missing two substitute values: ${SUB} and ${BASEDOM}. For example;

${DOM} = sub.example.com ${SUB} = sub ${BASEDOM} = example.com

This way, I could use:

${BASEDOM}_${SUB}

Which would result in the database example_com_sub and not sub_example_com, the current default.

I'm willing to build this feature, but only if it can be added to the stable source :)

Topic locked