sometimes you grap a cloud image, you create a flavor and launch an instance and Ooops your dont know the password.  this tool is amazing. before creating the image for your instance, use guestfish and change the password of any user within the shadow file. offcourse you will need to create an encrypted password. you can do that using openssl.

openssl passwd -1 changeme
$1$lj729X5O$Kkyw3BRdCjgeNvOZ9Xxp./

then use guestfish type the password you have encrypted and save

# guestfish --rw -a <image-name>
><fs> run
><fs>list-filesystems
><fs> mount /dev/vda1 /
><fs> vi /etc/shadow

create your image

openstack image create rhel_73 --disk-format qcow2 --container-format bare --file /home/stack/rhel-guest-image-7.2-20151102.0.x86_64.qcow2

now you can launch an instance and use this password to login to our cloud instance.

for the full manual of guestfish check :

http://libguestfs.org/guestfish.1.html

alternatively, you can use the secure public key that you generate from OpenStack instance wizard to login ssh to the instance.

you need to create a key from the instance wizard

 

then download the key to a machine that is accessible to the instance, you would probably then create a floating IP to access the instance.

download the key when created, and keep safe, you will not be able to download private key again. use the private key to ssh to the instance while the public key remain in the instance.

[root@overcloudssl-compute-0 ~]# ssh -i my.key  cloud-user@10.100.100.18
The authenticity of host '10.100.100.18 (10.100.100.18)' can't be established.
ECDSA key fingerprint is c5:b3:b8:d5:f5:26:35:4d:50:9a:c4:20:b5:4f:7e:3a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.100.100.18' (ECDSA) to the list of known hosts.

[cloud-user@mymach ~]$

have fun open_stacking

Leave a Reply