The ubuntu user is defined in the file /etc/cloud/cloud.cfg
, by default the Ubuntu/CentOS have his configuration with have already one user created.
The most easy way is edit this file in the SO image. Other solution is edit this file using the curtin_user_data or cludinit deploy scripts (https://maas.io/docs/snap/2.8/ui/custom-machine-setup).
This is a example of cloud.cfg provided by default with CentOS 8:
users:
- default
[___skipped some lines ___]
system_info:
default_user:
name: centos
lock_passwd: true
gecos: Cloud User
groups: [adm, systemd-journal]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
distro: rhel
paths:
cloud_dir: /var/lib/cloud
templates_dir: /etc/cloud/templates
ssh_svcname: sshd
You only need to modify the name: centos
by other username.
NOTE: you can write files in the curtin_userdata using this syntax:
write_files:
cloudconfig:
path: /etc/cloud/cloud.cfg
permissions: '0400'
content: |
RAW CONTENT HERE
CAN HAVE MULTIPLE LINES
NOTE2: I recommend to launch an ansible playbook instead write files using curtin.