How to stop creating a user on Cloud-init template?

Som1031

New Member
Feb 10, 2021
4
0
1
India
Virtualization: KVM

Is there any way to stop creating a new default user on newly created VM using Cloud-init template?

Right now on my centos cloud-init template created by me has this config

# nano /etc/cloud/cloud.cfg

Code:
system_info:
  default_user:
    name: centos
    lock_passwd: false
    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

Because of this every time when I create a new VM usign this template it's automatically create a user called "centos"

But I want the new VM only have root user and not any other user

So is there any way to do that?

I read lots of cloud-init tutorials but not able to find any solution for this
 
You can’t really start a VM off of those templates without a cloud-init datasource or some hackery which is difficult to automate and scale. In other words, you can’t even choose to ignore cloud-init unless you want to craft your own templates.

Thank you for your reply.

So there's no way to use cloud-init template but without creating the default user?


I was using solusvm for many years and have very little experience with Proxmox system

on solusvm creating and using template is very easy

But here it's not so.. I can't create template and make vm from so easily


For example a production use VM template which can creat a VM with user define hostname, resize the partition, etc.
Like I used to do with SoulsVM templates
 
Just pick already existing account name like "nobody" or "root" (I use root, because it also creates sudo rule for that account with nopasswd option).
 

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!