Using Grizzly on Ubuntu 12.04 servers and deployed Ubuntu 12.04 cloud image to Openstack?

When a user creates an instance from this image, they will not be able to login immediately because they don't have a user-password. 

So to deal with this, go ahead and create an Ubuntu Cloud image which prints username-password to the instance log; or uses a static user-password at the first creation of the instance. 

Let's do this:

  1. Firstly install guestfish:
# apt-get install guestfish

2. In order to edit the img file:

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

3. Then, start your image file:

><fs> run

4. Find the image local disk:

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

5. Mount the image disk to guestfish root:

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

6. Edit /etc/cloud/cloud.cfg file in order to load whatever you want, when instance created, etc.. In case you want to set user password for ubuntu user, you should add these lines to the cloud.cfg file:

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

Save and exit from guestfish.
7. 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

ubuntu:*********

**This solution supports Grizzly version. For Havana it will not work.

Did this answer your question?