Don't create default user with custom cloudimg template

f4242

Well-Known Member
Dec 19, 2016
101
4
58
Quebec, QC
Hello,

I'm currently working to create a custom Ubuntu 22.04 KVM template. I wonder if there is a way to disable the user creation with cloud-init? I would like the user and password submitted in the cloud-init panel in the PVE GUI to be ignored.

I tried to remove the default_user section from /etc/cloud/cloud.cfg. By doing this, the user is not granted sudo privilege like before, but the user is still created. Can I avoid this?

Thanks.
 
In fact, I wonder if there is a way to run the cloudinit configuration only at first boot. I found that when I do any change in the cloudinit panel, it seem to restart the configuration (create new ssh host keys, install updates, etc). This is something I would like to do only once at provisioning only.
 
The goal of cloud-init for Cloud Infrastructures is to provision and update cloud instances as needed. That includes pushing new keys, packages, etc to existing VMs.
The PVE in this case only works as 3rd party text script generator and packager, it does not control what your VM does with that script. Its up to you to configure the VM to process cloud-init once, disable it, etc.

The PVE GUI driven cloud-init is a small subset that is applicable to many environments, especially less sophisticated ones.
However, if you are looking to go beyond what PVE GUI offers then you need to use "custom" cloud-init files.
There is a lot of good information here: https://cloudinit.readthedocs.io/en/latest/index.html


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
I found how to disable it after the first boot. I added this at the end of cloud.cfg:

YAML:
runcmd:
  - touch /etc/cloud/cloud-init.disabled

About the user creation, I commented a bunch of module in cloud.cfg so it stopped to create them!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!