Reset the Root Password
The easiest way to reset the root user password is through the control panel. This method works even if the old password is lost, as you do not need to enter it.
However, you can also reset the password directly in the operating system, using the guide below.
If You Know the root Password Copy link
If you know the current password for the root user, you can change it as follows.
- Connect to the server via SSH as
rootusing the current password. - Execute the command:
passwd- The system will ask for the new password twice. Enter it.
Done, the password is changed. You can now log in as root using the new password.
If the root Password is Unknown Copy link
If you don't know the current root password, you can reset it and set a new one by booting the server from the recovery disk.
- Boot the system from the recovery disk.
- In the Console in the control panel
- Mount the
rootpartition. Its name may vary:sda1orvda1. First, try:
mount -o rw /dev/sda1 /mntIf you receive the error:
mount: /mnt: fsconfig system call failed: /dev/sda1: Can't lookup blockdev.run:
mount -o rw /dev/vda1 /mntThen execute:
chroot /mnt /bin/bash
passwd root- The system will ask for the new
rootpassword twice. Enter it.
If the password is changed successfully, you will see a confirmation message, such as: passwd: all authentication tokens updated successfully or password updated successfully.
- Press CTRL + D to exit
chroot. - Unmount the disk with the command:
umount /mnt- Remount the root file system in read-only mode, using vda1 or sda1, depending on what worked in the Step 3:
mount -o ro /dev/sda1 /mnt- Reboot the server in standard mode via the control panel.
Now you will be able to connect to the server as root using the new password.