Simple question, hard to find the answer... How to change default user of deployed Machine?



This sounds like a simple question but I can’t find a straight and simple answer to it!

When deploying Machines via MaaS, the “default_user” create by cloud-init (I believe), is “ubuntu”.

I don’t want it!

In an OpenStack / Cloud environment, I have the following block in my Heat templates for my “OS::Nova::Server”:

user_data: |
      name: "tcmc"
    list: |
    expire: False

So, how can I do this in MaaS, in a wah that all Machines will get it automatically?

I tried many pressed stuff, none worked.

No idea about how to do this simple thing on MaaS globally.



Looking at the cloud-unit/user-data section here, possibly you can set the same user-data you are setting with heat via the the maas cli.

Disclaimer: Never actually tried changing the default user, but this seems reasonable.


I was reading that doc yesterday… I tried to create a new file called “curtin_userdata_ubuntu” with my #cloud-init block, then, the deployments started to fail.

I also tried to write a file, /etc/cloud/cloud.cfg.d/default_user.cfg but that file never appeared…

I tried to change the default user for about 5~6 hours yesterday without success…



I was reading the following post:

…and tried to write_files into my cloud init cfg subdir… Didn’t worked…

BTW, it would be AWESOME to have this implemented:

Then, I found another example, here:

…at line 99, tried, didn’t worked either!

So, it’s near to “impossible” to do a simple thing, change the default user of a deployed Machine with MaaS.

I gave up for now.

I’ll just create another user for me with Ansible and move on…



I guess that I’m also facing the following bug:

While I can’t see that specific error:

curtin: Installation failed with exception: 'NoneType' object has no attribute 'keys'

My deployment also fails if I try this:

File `/etc/maas/preseeds/curtin_userdata_ubuntu that contains:

    name: "tcmc"

Still don’t know how to change the default_user… It’s kinda of, embarrassing, to not be able to do this.


I do this from the CLI.

lloyd@maas:~$ cat cloud-config-common
  - name: lloyd
    gecos: Lloyd Parkes
    groups: adm, sudo
    shell: /bin/bash
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCySWOEbC1w3TdImewA1eBLiyE2jM/Tn6dCrGhNmNTQNNITgg0Huy4cLDpuUASUqWEF7YVWkEseW6Kz01Y5KxRfiQDRYBxql7nsdEp4YuHmaYOBoAcjm/p7FOVPcAHZ0S1qRVNvL+zANvJHFINUoVblu3+WN/87NVPdEFtNa/QeX9N7RFbfw8NA85cFbgjFnVXX3ipJsduJYrspsCYJfxqoGNKswv79Zdi5SGkJQNn4bHRimtaF8MPtEOy0WhjKCcaf3DSbGtTMmEhcS6M/zKUlwGnyiwgRysuF+DeiyEedXtNwDJqL9kXP4w9KPQtnjlICwAG178c9MRaYzHA2gReX lloyd@ansible
lloyd@maas:~$ maas cli machine deploy ces6hn user_data=$(base64 -w0 -i cloud-config-common) distro_series=bionic


You can add a section like the following to /etc/maas/preseeds/curtin_userdata

  # Create cloud-init config that configures the 'root' user as the
  # default user instead of 'centos'.
  # Additionally, enables password authentication for this user.
    path: /etc/cloud/cloud.cfg.d/00-user.cfg
    content: |
     ssh_pwauth: yes
     disable_root: false
         name: root
         lock_passwd: false
         plain_text_passwd: 'test'