Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I found how:

Firstly install guestfish:

# apt-get install guestfish

In order to edit the img file:

# guestfish --rw -a precise-server-cloudimg-amd64-disk1.img

Then, start your image file:

><fs> run

Find the image local disk:

><fs> list-filesystems
/dev/vda1: ext4

Mount the image disk to guestfish root:

><fs> mount /dev/vg_centosbase/lv_root /

Now, you can edit /etc/cloud/cloud.cfg file in order to load whatever you want when instance created. I wanted to set user password for ubuntu user, so I added these lines to the cloud.cfg file:

password: RANDOM
chpasswd: { expire: False }
ssh_pwauth: True

Save and exit from guestfish. That's it! :)

You can import this modified image to Openstack and Ubuntu password will be randomly created and printed to Console-log of the instance:

Generation complete.
Set the following passwords


guestfish operation referance:

For other options in cloud.cfg file: