Modify root password and other user passwords of kvm virtual machine
Earlier, because the root password of the kvm virtual machine was lost by the customer, this is really urgent. I think of a password file method that directly replaces the / etc/shadow file, which can be used to change the password.
On your other machine, look at root's shadow file and copy root's password file
Turn off the virtual machine
Virsh shutdown kvm-fenxsys
Force it to close when it can't be turned off.
Virsh destroy kvm-fenxsys
Virt-edit xxx (virtual machine name) / etc/shadow file, replacing the shadow file of root
Example:
Virt-edit kvm-fenxsys / etc/shadow
Start the virtual machine
Virsh start kvm-fenxsys
Log in with the new root password and get it done