Get the App
SLTechnology News&Howtos  ›  Servers  › 

Modify root password and other user passwords of kvm virtual machine

Shulou Source: shulou.com Published: 2022-06-02 17:30:00 10月03日 Update

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

Tags: File password worry customer method time Machine example Enforcement Login user Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Huawei Docker Redmi Shulou Information