Reset root password (VPS)
Please use the “Print” function at the bottom of the page to create a PDF.
For VPS, which were purchased after 2023/05/16
In this article, you will learn how to reset the root password of a Linux VPS.
Prerequisites
- The server is switched on.
- You have created an image of the server in question.
Download DVD Clonezilla latest_iso
- Log in to your IONOS account log in.
In the title bar, click on Menu > Server & Cloud.
Optional: Select the desired Server & Cloud contract.- Activate the desired server.
- Click on DVD drive.
- Select the Clonezilla latest_iso DVD.
- Click on Load DVD.
Boot Clonezilla from DVD
- Click on Actions > Restart.
- Click on Yes.
- Click on Actions > Open remote console.
The remote console opens in a new tab. - Select the desired language in the Choose language window.
- In the Keyboard configuration window, select the Change keyboard layout option.
- Select the option Generic PC keyboard with 105 keys.
- In the Configuring keyboard-configuration window, select the keyboard layout.
- Select the country of origin for the keyboard.
- Select the keyboard layout.
- Select the key that is to function as AltGr.
- Select the Compose key.
- In the Start Clonezilla window, select the Enter_shell command line prompt option.
Reset Password
To call up information on all discs, enter the following command:
user@debian:~$ sudo fdisk -l
- Determine the root partition. The name of the root partition of a dedicated server with software raids is /dev/vda5, for example, depending on the operating system.
To mount the root partition, enter the following command:
user@debian:~$ sudo mount /dev/MY_ROOT_PARTITION /mnt
Replace the placeholder MY_ROOT_PARTITION with the name of the root partition of your VPS. Examples:Ubuntu 22.04
user@debian:~$ sudo mount /dev/vda1 /mnt
Rocky Linux 8.6:
user@debian:~$ sudo mount /dev/vda5 /mnt
AlmaLinux 9:
user@debian:~$ sudo mount /dev/vda4 /mntFor the next steps it is necessary to mount the directories /dev, /proc and /sys. To do this, enter the following commands:
user@debian:~$ sudo mount --bind /dev /mnt/dev
user@debian:~$ sudo mount --bind /proc /mnt/proc
user@debian:~$ sudo mount --bind /sys /mnt/sysSet the mounted partition to a change root environment:
user@debian:~$ sudo chroot /mnt
To set a new password, enter the following command:
[root@debian:/]# passwd root
- Enter the new password and repeat it.
To terminate the access to the root file system enter the following command:
[root@debian:/]# exit
Enter the following command:
user@debian:~$ sudo touch /.autorelabel
To ensure that all changes are correctly applied to the system files, enter the following commands:
user@debian:~$ sync
To unmount the /dev, /proc and /sys directories, enter the following commands:
user@debian:~$ sudo umount /mnt/dev
user@debian:~$ sudo umount /mnt/proc
user@debian:~$ sudo umount /mnt/sys
Eject DVD
- Open the Cloud Panel.
- To eject the DVD, click on Clonezilla latest_iso.
- Click on Yes.
- Click on Actions > Restart.
- Click Yes.
The server is restarted. You can then log in to the server with the new password.