Monday, November 3, 2014

How to change root password in a qcow2 image using guestfish?

[root@templates]# guestfish --rw -a LoadBalancer-MN.qcow2

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for help on commands
      'man' to read the manual
      'quit' to quit the shell

><fs> run
><fs> mount /dev/sda1 /
><fs> cp /etc/passwd /etc/passwd-bkup
><fs> vi /etc/passwd

#in the file change the root line second parameter from x to blank "":
#from: root:x:0:0:root:/root:/bin/bash to root::0:0:root:/root:/bin/bash

><fs>
><fs>
><fs> umount /
><fs> exit


1 comment: