Change password of VM image using guestfish

[root@psuriset ~]# guestfish –rw -a /var/lib/libvirt/images/trusty-server-cloudimg-amd64-disk1.img

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

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

><fs>
><fs> ls
ls should have 1 parameter
type ‘help ls’ for help on ls
><fs> run
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
><fs> list-filesystems
/dev/sda1: ext4
><fs> mount /dev/sda1 /
><fs> vi /etc/sh
/etc/shadow   /etc/shadow-  /etc/shells
><fs> vi /etc/sh
/etc/shadow   /etc/shadow-  /etc/shells
><fs> vi /etc/shadow
><fs> vi /etc/sudoers

—- here edit passwd and quit using “exit”—

psuriset ALL=(ALL) NOPASSWD: ALL

><fs> quit
[root@psuriset ~]#

[root@psuriset ~]# virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  ‘help’ for help with commands
‘quit’ to quit
virsh # start cbtool
Domain cbtool started

virsh # list
Id    Name                           State
—————————————————-
15    cbtool                         running

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s