Sign In
Sign In

Reset the Root Password

Updated on 03 February 2026

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.

Note that If you change the password via SSH, the root password you can copy in the control panel will no longer work.

If You Know the root Password

If you know the current password for the root user, you can change it as follows.

  1. Connect to the server via SSH as root using the current password.
  2. Execute the command:
passwd
  1. 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

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.

  1. Boot the system from the recovery disk.
  2. In the Console in the control panel
  3. Mount the root partition. Its name may vary: sda1 or vda1. First, try:
mount -o rw /dev/sda1 /mnt

If you receive the error:

mount: /mnt: fsconfig system call failed: /dev/sda1: Can't lookup blockdev.

run:

mount -o rw /dev/vda1 /mnt

Then execute:

chroot /mnt /bin/bash
passwd root
  1. The system will ask for the new root password 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.

  1. Press CTRL + D to exit chroot.
  2. Unmount the disk with the command:
umount /mnt
  1. 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
  1. 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.

Was this page helpful?
Updated on 03 February 2026

Do you have questions,
comments, or concerns?

Our professionals are available to assist you at any moment,
whether you need help or are just unsure of where to start.
Email us
Hostman's Support