Ubuntu – How to set a password for Ubuntu Cloud Images (ie. NOT use ssh)


I'm running an OpenStack cloud with a very particular network configuration, that makes it impossible for an instance to communicate with anything in the outside world until after I login into it and set several config files.

As a result of this, I cannot log in to instances using SSH keys. Is there a way to set a default password on an Ubuntu 12.04 (has to be 12.04) cloud image so I can log in to it directly from the Horizon console? I tried using the procedure outlined at https://ask.openstack.org/en/question/5531/defining-default-user-password-for-ubuntu-cloud-image/ but it did not work on Ubuntu 12.04… it did work on 14.04 though.

Best Answer

You can first create a Virtual Machine (VM) image from virtualbox or vmware which already has a key pair. as you can control your virtualbox or vmware freely, you can get the key pair from the virtual host.

  1. then import the keypair into your openstack.

  2. upload this virtual machine image

  3. create a instance(A) from this image

  4. create a instance(B) from the cloud image with the keypair(uploaded from step 1) injected

  5. open the console(in horizon) of instance A, now you can connect the instance B from A, because B has injected the public key from A

  6. after logged in, you can set up the environment for instance B & change the configuration

Related Question