User password expiration

Hi there,

I got a question for cloud.conf in gadget snap. I added the below codes for user password expiration:

chpasswd:
  expire: True

But it doesn’t work. I am not sure if snapd uses this code: https://github.com/number5/cloud-init/blob/master/cloudinit/config/cc_set_passwords.py#L220-L230. On line 224, https://github.com/number5/cloud-init/blob/master/cloudinit/config/cc_set_passwords.py#L224, it refers to cloud.distro.expire_passwd(u). Since the uc20 cloud.conf uses NoCloud, does NoCloud have the correct implementation for expire_passwd?

As a workaround, I am using the command passwd --expire username.

Thanks,
Hao

This sounds like a cloud-init question, if you show your entire cloud-init config and how you are using it with UC20 I can take a look, but it’s quite possible that I will still not know why it doesn’t work.

I used the below lines after datasource_list: [NoCloud] in cloud.conf:

chpasswd:
  expire: True

It seems NoCloud may not run the correct passwd command to invalidate passwords. Where could I find the source codes for NoCloud?

Thanks!

No idea where specifically, but https://github.com/canonical/cloud-init is the upstream source for cloud-init, so somewhere in there

1 Like