In this article, we'll show you how to reset the root password of your VPS using a rescue system.

Caution

These instructions list steps that can lead to data loss if performed incorrectly. Therefore, always create a backup before resetting the root password.

Prerequisites
  • The server is powered on.

  • You created a backup of the server.

Loading the Rescue System

  • Log in to your IONOS account.
  • Click on the Server & Cloud tile. If you have multiple server contracts, select the appropriate one.

  • Select the desired server.

  • Click on DVD drive.

  • Select the DVD Gparted latest_iso.

  • Click on Load DVD.

  • Click on Yes.

The server will restart, and the DVD will be loaded. This may take a moment.

Starting the Rescue System

  • Click on Actions > Open remote console.

  • If you see the screen below, select GParted Live (Default Settings) from the menu. Otherwise, you will be taken to the next step.

  • Select any policy and confirm it with OK.

  • Select a language. The default is 33 for English.

  • Enter 0 for the start method.

Changing the Password

  • Close the GParted window by clicking on the black rectangle.

  • Start the Terminal program.

  • To switch to the root user, enter the following command:

    user@debian:$ sudo su

  • Read the hard disk/partition layout with the lsblk command.

    user@debian:$ lsblk

Hint

The name of the root file system is required for the next steps. This is usually the largest partition. In this example, vda is the name of the virtual hard disk and vda1 is the root file system.

  • To mount the root file system, enter the following command and replace the placeholders (PATH and PARTITION):

    root@debian:/home/user# mount /PATH/PARTITION /mnt

    Example

    root@debian:/home/user# mount /dev/vda1 /mnt

  • Check whether the load was successful by executing the lsblk command again. In the example below, the current mountpoint /mnt is listed in the line vda1.

    root@debian:/home/user# lsblk
    NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
    loop0     7:0    0   423M  1 loop /usr/lib/live/mount/rootfs/filesystem.squashfs
                                      /run/live/rootfs/filesystem.squashfs
    sr0      11:0    1   488M  0 rom  /usr/lib/live/mount/medium
                                      /run/live/medium
    vda     254:0    0   240G  0 disk
    ├─vda1  254:1    0 239.9G  0 part /mnt
    ├─vda14 254:14   0     3M  0 part
    └─vda15 254:15   0   124M  0 part

  • Change to the root file system with the following command: chroot /mnt

    root@debian:/home/user# chroot /mnt

  • To start the password change, enter the following command: passwd root

    root@debian:/home/user# passwd root
    New password:
    Retype new password:
    passwd: password updated successfully
    root@debian:/#

  • Enter the new password and repeat it

Please Note

While you are entering the new password, it will not be displayed for your protection. After you have entered and confirmed your desired password twice, it has successfully been changed.

Caution

Finally, perform the following steps before going back to your regular operating system. Otherwise, there is a risk of data loss.

  • Terminate access to the root file system with the exit command.

    [root@debian:/]# exit
    exit
    root@debian:/home/user#

  • To unmount the root file system, enter the command below. Replace the placeholders (PATH and PARTITION).

    umount /PATH/PARTITION

    Example:

    root@debian:/home/user# umount /dev/vda1

  • To check whether the unmounting was successful, execute the lsblk command. If your root file system is no longer followed by /mnt, you have successfully unmounted the file system.

    root@debian:/home/user# lsblk
    NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
    loop0     7:0    0   423M  1 loop /usr/lib/live/mount/rootfs/filesystem.squashfs
                                      /run/live/rootfs/filesystem.squashfs
    sr0      11:0    1   488M  0 rom  /usr/lib/live/mount/medium
                                      /run/live/medium
    vda     254:0    0   240G  0 disk
    ├─vda1  254:1    0 239.9G  0 part
    ├─vda14 254:14   0     3M  0 part
    └─vda15 254:15   0   124M  0 part

Ejecting the DVD

  • Switch back to the Cloud Panel.

  • In the Infrastructure > Servers section, click on the DVD icon labeled gparted latest_iso.

  • Click on Yes.

The DVD will now be ejected, and your server will be restarted. This may take a moment.