[Openstack]: Set user password when launching cloud images

I recently installed OpenStack Mitaka on my test bed and imported few images from CentOS & Ubuntu repositories.  Once the VM is booted, I tried to login through VNC console. Unfortunately, I didn’t knew the username and password and the information was not available on the page where the image was downloaded as well. Fortunately, there was a way to insert a password while booting the instance and here’s how it is done.

Create a file called userdata.txt with the below contents:

#cloud-config
password: mypasswd
chpasswd: { expire: False }
ssh_pwauth: True

Now, pass userdata.txt file as an input while creating a new instance as shown below:

login to instance

#openstack server create --flavor m1.small --image Ubuntu-Trusty --key-name  mykey --nic net-id=88536e89-12a9-41eb-8aed-57983ee299e8 --security-group default --user-data=userdata.txt my-ubuntu

The above command will set password mypasswd for the default user ubuntu.

Also when using GUI for the launch you can specify the above configuration as shown below:

Change login password during VM launch

Now you can login with the below credentials:

Username: ubuntu
Password: mypasswd

Topics :

vps germany

Get Free Email Updates

Disclaimer: The content published in this article is the views of the author only. Techglimpse does not gurantee accuracy, completness or validity. If you believe the content on this post violates your copyright, please send us a mail for removal. Read more.