Using rescue mode to reset VPS Linux Debian root password

How to switch to rescue mode

It depend on your VPS provider, I use bero-host.de which offer couple of rescue ISO to mount.

I will use SystemRescueCD for this example.

Mount into rescue mode

Choose normal mode is enough for this example.

Check for your Debian Disk and partition and mount it.

lsblk
fdisk -l

In this example, Debian operating system is on /dev/sda3

Next step, mount the partition

# 掛載 root 分區
mount /dev/sda3 /mnt

# 進入 chroot 環境
chroot /mnt

## Option 1, remove preset root user password
mount /dev/sda3 /mnt
nano /mnt/etc/shadow

### Replace root:$y$j9T$....:1234:1234  to root::.... 

## Option 2
## Only use if you know your VPS provider not using /mnt/etc/shadow to configure your password (qmenu-agent)
## Reset the root user password
passwd root


exit
umount -R /mnt
shutdown -r now

From this change to

Final reboot into your Debian operating system and set root password again.

## Login: root
Password: leave it blank, just press "Enter" to continue.

## Set new root user password
passwd root