[Openstack]: Set user password when launching cloud images

Updated on September 2, 2017

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:

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

Was this article helpful?

Related Articles

Comments Leave a Comment

  1. Terima kasih. Cara ini simpel namun berfungsi. Terima kasih banyak

Leave a Comment