lost and found ( for me ? )

Fedora 19: mount cirros qcow2 image with guestfs-tools

small tips

When evaluating openstack RDO by using cirros images, I would like to change root user’s credentials from default credentials “cubswin:)” to other letters before booting instances.Because I could not enter colon “:” via VNC in my environment for some reasons.

Here’s how to mount cirros qcow2 image and edit /etc/shadow.

I changed credentials to hello.
dump credentials for shadow file
# echo "hello"| openssl passwd -1 -stdin
$1$/xfGm6Qk$zSUqaHU5nycXbK/Za.D1v0

install libguestfs-tools and mount qcow2 image.
# yum install libguestfs-tools


- mount qcow2 image

# mkdir mnt
# guestmount --rw -a cirros-0.3.1-x86_64-disk.img -i mnt

# cd mnt/

# cd etc/


- before editing shadow

# cat shadow
root:!$1$LJwQnqlv$DK6oKqcTq9Rf2ClC.kMa3/:10933:0:99999:7:::
bin:*:10933:0:99999:7:::
daemon:*:10933:0:99999:7:::
adm:*:10933:0:99999:7:::
lp:*:10933:0:99999:7:::
sync:*:10933:0:99999:7:::
shutdown:*:10933:0:99999:7:::
halt:*:10933:0:99999:7:::
uucp:*:10933:0:99999:7:::
operator:*:10933:0:99999:7:::
ftp:*:10933:0:99999:7:::
nobody:*:10933:0:99999:7:::
cirros:$1$LJwQnqlv$DK6oKqcTq9Rf2ClC.kMa3/:10933:0:99999:7:::

# cp shadow shadow.org


- after editing shadow file

# cat shadow
root:$1$/xfGm6Qk$zSUqaHU5nycXbK/Za.D1v0:10933:0:99999:7:::
bin:*:10933:0:99999:7:::
daemon:*:10933:0:99999:7:::
adm:*:10933:0:99999:7:::
lp:*:10933:0:99999:7:::
sync:*:10933:0:99999:7:::
shutdown:*:10933:0:99999:7:::
halt:*:10933:0:99999:7:::
uucp:*:10933:0:99999:7:::
operator:*:10933:0:99999:7:::
ftp:*:10933:0:99999:7:::
nobody:*:10933:0:99999:7:::
cirros:$1$/xfGm6Qk$zSUqaHU5nycXbK/Za.D1v0:10933:0:99999:7:::


# cd ../..

- unmount

# guestunmount mnt/



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.