Resetting Your Root Password (Cloud Server and VPS)
For Cloud Server and Virtual Private Server packages
In this article, we'll show you how to reset the root password of your Linux Cloud Server or Virtual Private Server using Knoppix.
Prerequisites:
You have logged into the Cloud Panel.
The server is powered on.
You are in the Infrastructure > Servers section.
You have created a snapshot of the server.
Please Note
When you hover the mouse cursor over the icon, the program name Terminator is displayed.
The /bin/bash window opens.
To switch to the root user without a password prompt, enter the following command:
:~# suCreate the directory where the volume group should be mounted.
:~# mkdir /mnt/oldTo determine the volume group to mount, type the following command:
:~# vgsThe volume group is displayed.
Example:
run/lvm/lvmetad.socket: connect failed: No such file or directory
WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
VG #PV #LV #SN Attr VSize VFree
vg00 1 2 0 wz--n- 79.52g 0
In the above example, the name of the volume group is vg00. This name may vary depending on the Linux version.To activate the volume group, enter the vgchange -ay command in the following form:
:~# vgchange -ay NAMEOFTHEVOLUMES
Example:
:~# vgchange -ay vg00To query information about the existing Logical Volumes, enter the following command:
:~# lvdisplay
Normally, two Volume Groups are displayed. Compare the VSize value that was displayed to you after you entered the vgs command with the LV Size value. The LV Size value is displayed after you enter the lvdisplay command for each existing Logical Volume. Make a note of the path of the Logical Volume whose size approximately matches the VSize value. This path is displayed under the LV Path item.To mount the detected volume, type the following command:
:~# mount LV Path /mnt/old
Example:
:~# mount /dev/vg00/lv01 /mnt/oldTo reset the root password for the Linux operating system installed on the server, you must change the root directory by entering the following command:
:~# chroot /mnt/oldTo change the root password, enter the following command:
passwdTo exit the chroot environment, type the following command:
exitTo unmount the drives, enter the following command:
umount -a