canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.52k stars 631 forks source link

Give the option to create your own username instead of being stuck with the default "ubuntu". #3491

Closed novialriptide closed 2 months ago

novialriptide commented 2 months ago

What are you trying to do? Give the option to create your own root user with a custom username instead of being stuck with the default "ubuntu".

What's your proposed solution? multipass launch lts --username andrew

andrei-toterman commented 2 months ago

Hi, @novialriptide! Thanks for the suggestion! For the time being, you can use the --cloud-init option to pass some configuration to create the users you want. You can read more about the schema of the config and see some examples here: https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups

novialriptide commented 2 months ago

Thank you @andrei-toterman for the quick response. Are you open to the idea being worked on? I would like to give my best efforts to work on this issue.

andrei-toterman commented 2 months ago

@novialriptide, is there some particular reason you'd really need the username to be different or is it simply a cosmetic issue? In case you find using a cloud-init file cumbersome, you can use a bash 'here string' like so:

multipass launch --cloud-init - <<< 'users: [name: andrei]'
novialriptide commented 2 months ago

@andrei-toterman, just a cosmetic issue.

andrei-toterman commented 2 months ago

Then, at least for the moment, I don't think we'd like to integrate this feature. The reason for this is to avoid feature creep. If we allow setting the username through a flag, this could raise the question of what other users configurations should be set through flags, like groups, passwords, keys etc. If someone wants to set the username, they would use the --username flag. But if they also want to set a password, then suddenly they have to go back to cloud-init. And this would split the CLI experience into two: configuring users through the flags that we support or, in the case of flags we don't support, fall back on cloud-init.

Still, maybe in the future we might consider this again. If, for example, we will allow users to run other distributions besides Ubuntu, then I think it would be strange to have an ubuntu username on a Fedora VM.

So thanks again for the suggestion, but I will close this for now. Have a nice day!