Cloud-Init Password Hash

I'm trying to create a user with cloud-init using the Ubuntu 18.04 image. Here's my config:

users:
  - default
  - name: ken
    passwd: $6$rounds=4096**REDACTED**
    ssh-authorized-keys:
      - ssh-rsa **REDACTED**
    sudo: ALL=(ALL) NOPASSWD:ALL
    groups: sudo
    shell: /bin/bash

I'm able to ssh into the server once it's booted so I know the SSH key has been copied using cloud-init. However, I'm unable to login using virt-manager so I know the password wasn't set correctly. Also, /etc/shadow has an "!" where the hash should be.

I used mkpassword to create the hash per the instructions here: https://cloudinit.readthedocs.io/en/0.7.8/topics/examples.html.

How do you set the password for a new user using cloud-init?


lock_passwd: Optional. Disable password login. Default: true

Set lock_passwd: false, so that your password is written to /etc/shadow. Got the same problem and this was the only help.

documentation at https://cloudinit.readthedocs.io/en/latest/topics/modules.html#users-and-groups