1. Home
  2. Own server
  3. Debian
  4. How can I reset the root password of my Linux server?
  1. Home
  2. Own server
  3. Ubuntu
  4. How can I reset the root password of my Linux server?

How can I reset the root password of my Linux server?

Once you have forgotten the root password, you can no longer log into the server. We have here an explanation of how to change your root password.

You must first start your server in rescue mode .
You can connect to the loaded minimal Linux on your server via SSH.

In order to change the password, you must first mount the partition and important directories. We have listed the relevant commands for you below.

ssh root@XXXX.hostserv.eu

Du musst XXXXX mit der Servernummer deines Servers ersetzen

mount /dev/sdXX /mnt

Ersetze hier XX durch deine Partition, bspw. sda1. Falls du nicht sicher bist, welche Partition du verwenden musst, gib den Befehl fdisk -l oder lsblk ein

mount --bind /dev /mnt/dev/ 
mount --bind /proc /mnt/proc/
mount --bind /sys /mnt/sys/

Now you have to switch to the chroot environment

chroot /mnt /bin/bash

You can now change your system passwords.
(replace the password here with your own new password)

passwd root NEUES_ROOT_PASSWORT
passwd administrator NEUES_ADMINISTRATOR_PASSWORT
exit


Damit verlässt du die chroot Umgebung wieder.

You now have to unmount the mounted directories and partitions again.

umount /mnt/sys/

umount /mnt/proc/

umount /mnt/dev/

umount /mnt/

Now you can perform a reset in the myhosttech customer center so that the server no longer starts in rescue mode.

Updated on 17. November 2026
Was this article helpful?

Related Articles

Benötigst du Support?
Deine Lösung steht noch nicht in den FAQ? Keine Sorge, wir sind für dich da.
Kontaktiere uns!