cloud-init vm with specific UID/GID

fonze98

New Member
Oct 15, 2022
13
1
3
I am wondering if it is possible to specify the UID/GID that the user that is created with cloud-init vm template images uses?

With my current setup when I use the VM template for an Ubuntu server it creates a user with uid 1000. I need this user to have UID of 3000 so I have to log in create another user with sudo, switch over, change the UID/GID of the first user, switch user again verify it changed then remove the second user.

I would love to find a simpler way to do this.
 
you need to use custom cloud-init, ie "-cicustom":
https://cloudinit.readthedocs.io/en/stable/reference/modules.html#users-and-groups:~:text=uid: (integer/string) The user’s ID. Default is next available value..

PS if you want to stick with non-custom is to have template with user ids from 1000 to 2999 pre-created, since it uses next available id. Not sure if that qualifies as "simpler".


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:
So I have made a couple of clones from the template with the custom user cloud init yml. and found that after using the --cicustom when you clone the template it no longer fills in the hostname using the name you give in the GUI. I did a search on this and found this post but I am not following how they are using the vendor config to set the hostname correctly. Am I missing another component to make this work or do I just need to manually set the hostnames after using the cicustom flags for userdata?
 

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!