GitHub user top-secrett added a comment to the discussion: Rocky Linux 9 and 
Ubuntu 24.04 template with cloud-init doesn't reset password on next subsequent 
boots

@hanisirfan @weizhouapache I think I found a solution. Maybe It is not the 
best, but it works on Ubuntu 22.
1. In ```/etc/cloud/cloud.cfg``` do not touch ```- set_passwords```.
2. Create service based on scipt 
https://github.com/apache/cloudstack/blob/main/setup/bindir/cloud-set-guest-password.in
 
2.1. Place it in folder /etc/init.d/ folder with name for example 
"reset-cloud-password"
2.2. ```chmod +x /etc/init.d/reset-cloud-password```
2.3. Add lines in script after ```#!/bin/bash```
```
### BEGIN INIT INFO
# Provides:          password
# Required-Start:    $all
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: your description here
### END INIT INFO
```
And change user in script if it is necessary

2.4. Execute command to create service ```systemctl enable 
reset-cloud-password```
2.5. Edit service ```systemctl edit --full reset-cloud-password```
Add lines in the end
```
[Install]
WantedBy=multi-user.target
```
2.6. Enable service ```systemctl enable reset-cloud-password```

GitHub link: 
https://github.com/apache/cloudstack/discussions/9690#discussioncomment-10657096

----
This is an automatically sent email for users@cloudstack.apache.org.
To unsubscribe, please send an email to: users-unsubscr...@cloudstack.apache.org

Reply via email to