User passwords

For a full list of keys, refer to the set passwords module schema.

Set default password

This example sets a default password that would need to be changed by the user the first time they log in.

1#cloud-config
2{password: password1, ssh_pwauth: true}

Multi-user configuration

This example does several things:

  • Disables SSH password authentication

  • Doesn’t require users to change their passwords on next login

  • Sets the password for user1 to be 'password1' (OS does hashing)

  • Sets the password for user2 to a pre-hashed password

  • Sets the password for user3 to be a randomly generated password, which will be written to the system console

1#cloud-config
2chpasswd:
3  expire: false
4  users:
5  - {name: user1, password: password1, type: text}
6  - {name: user2, password: $6$rounds=4096$5DJ8a9WMTEzIo5J4$Yms6imfeBvf3Yfu84mQBerh18l7OR1Wm1BJXZqFSpJ6BVas0AYJqIjP7czkOaAZHZi1kxQ5Y1IhgWN8K9NgxR1}
7  - {name: user3, type: RANDOM}
8ssh_pwauth: false