Skip to content

cloud init custom user-data script not picked up #41

@eayin2

Description

@eayin2

Platform

Hypervisor OS: Ubuntu-18.04
Guest OS: Ubuntu-18.04
kvm-install-vm: latest github version

Goal

I want to add an additional user with a specified password and without NOPASSWD in sudoers. By default kvm-install-vm uses ALL=(ALL) NOPASSWD:ALL for additional users.

Attempt

I tried to create a user-data.sh and run kvm-install-vm create -s "$HOME/user-data.sh" my-vm01, but it seems to have no effect. I can't login with ssh, nor through tty with virt-manager's graphical interface.

My guess is the config is not picked up. What might I be missing?

user-data.sh

# Users
users:
    - default
    - name: my-user
      groups: ['sudo']
      shell: /bin/bash
      sudo: ALL=(ALL) ALL
      ssh-authorized-keys:
        - ssh-ed25519 <my-pub-key>
      lock-passwd: false
      passwd: <my-salted-password-hash>

.kivrc

AUTOSTART=true
CPUS=1
MEMORY=1024
DISK_SIZE=20
IMAGEDIR="/mnt/500g01/virtualbox/image"
VMDIR="/mnt/500g01/virtualbox"
BRIDGE=br2
PUBKEY="${HOME}/.ssh/user01_ed25519.pub"
DISTRO=ubuntu1804
MACADDRESS=$(printf '%02x' $((0x$(od /dev/urandom -N1 -t x1 -An | cut -c 2-) & 0xFE | 0x02)); od /dev/urandom -N5 -t x1 -An | sed 's/ /:/g')
TIMEZONE=Berlin/Europe
VERBOSE=1

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions