Custom config / cloud-init
-
So i am trying to learn how to use the Custom config / cloud-init for ubuntu.
If I add my ssh-key to my user account in Xen orchestra (XOA or XO-CE) I can select that during the vm creation and that works but the VM is stuck with the username ubuntu. I would to change that.
I am not sure if I am messing up the user creation or the ssh-key as i am not able to log in do to authentication error.
My config ---
#cloud-config hostname: {name} users: - newusername ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1.....XbZH6muQrfegKoTsuw== Generated By TermiusThe above is not my actual key. In the key saved in user profile stops before the"==" and as stated that key works. So i assume if I correct the config to remove the "==" and after that key should work as well. So my assumption is the user name is the issue.
I would like to make the username to my desire but have the same permission as the user account ubuntu has when just inserting ssh-key.
-
Think I figured it out. first i was using the wrong key. A lot of going back and forth trying new keys forgot to swap back to original...
new config...
#cloud-config hostname: {name} users: - name: newusername gecos: New User sudo: ALL=(ALL) NOPASSWD:ALL groups: users, admin shell: /bin/bash ssh_authorized_keys: - ssh-ed25519 AAAAC3....18ZbAAny suggestions should I not use something in the above config if the server was in production?
-
So I started with a Ubuntu 24.4 image from XOA hub. I create a new vm from that image with my cloud config from above. I start the vm up. Once booted I shut it down and remove the Cloud config drive. leaving 1 single os drive. I boot the vm up and fully update the vm and install a few minor tweaks. Then shut the vm down. Networking is configure dhcp.
If convert this newly created vm to a template. Then create another vm from this template. Even though the VM is generating a new mac address when the vm boots its still getting / using the same ip from vm used to create the template.
If i put either network configs in during vm creation from new template i get no ip address. I cant log into console because the user does not have a password. I have tried to put
password: userspasswordin the config but that does not work.network: version: 1 config: - type: physical name: eth0 subnets: - type: dhcpor
network: version: 2 ethernets: eno1: dhcp4: true