Resetting the root password of a Dedicated Server or Bare Metal Server (Ubuntu 24.04, Ubuntu 26.04, Debian 12, and Debian 13)
Please use the “Print” function at the bottom of the page to create a PDF.
Valid for: Dedicated Servers and Bare Metal Servers managed in the Cloud Panel
This article explains how to reset the root password of your Dedicated Server or Bare Metal Server using the Rescue System. The instructions cover both older partition schemes and newer installations (e.g. Debian 12 or Debian 13 on NVMe).
Caution
These instructions do not apply to the following distributions:
- AlmaLinux 8
- AlmaLinux 9
- AlmaLinux 10
- Rocky Linux 8
- Rocky Linux 9
- Rocky Linux 10
For AlmaLinux and Rocky Linux, see the following article:
Reset root password (Dedicated Linux Server with AlmaLinux 8 and 9 and Rocky Linux 8 and 9)
Requirements
- The server is switched on.
- You have created an image of the server.
- Log in to your IONOS account.
Click on Menu > Servers & Cloud in the title bar.
Optional: If you have multiple server contracts, select the desired contract.
- In the Infrastructure > Servers section, select the server.
- Click Actions > Restart. The Restart Server window opens.
- Select the Rescue System method and then select Rescue System (Linux).
- Click Yes. The server boots into the Rescue System.
- Scroll down to the Features section.
- To log in to the Rescue System, use the login details displayed there to establish an encrypted SSH connection to your server. Alternatively, to use the VNC console, click the down arrow next to the Console button and select VNC Console.
To display information about all storage devices, enter the following command:
rescue:~# fdisk -l
Identify the root partition. Its name depends on the hardware (hardware RAID or software RAID) and the operating system version. Look for the largest partition. Typical names:
- Modern software RAID systems (e.g. Debian 12 or Debian 13 on NVMe): /dev/md4 or /dev/md125
- Older software RAID systems: /dev/md2 or /dev/md126
- Hardware RAID: /dev/sda2
Examples:
Software RAID:
Disk /dev/md126: 419.2 GiB, 450103148544 bytes, 879107712 sectors
Units: sectors of 1 * 512 = 512 bytesHardware RAID:
/dev/sda2 6144 58593279 58587136 28G Linux filesystem
To mount the root partition, adapt the following command and then enter it. Replace the placeholder MY_ROOT_PARTITION with the name of the root partition you identified in the previous step:
rescue:~# mount /dev/MY_ROOT_PARTITION /mnt
Examples:
Older software RAID systems:
rescue:~# mount /dev/md126 /mnt
or
rescue:~# mount /dev/md2 /mnt
Modern software RAID systems with NVMe (e.g. Debian 13):
rescue:~# mount /dev/md4 /mnt
or
rescue:~# mount /dev/md125 /mnt
Hardware RAID:
rescue:~# mount /dev/sda2 /mnt
In some server configurations, system directories such as /usr, /var, or /home are located on separate partitions. These partitions must also be mounted so that commands within the system work. To check this, display the contents of the fstab file of the mounted system. To do this, enter the following command:
rescue:~# cat /mnt/etc/fstab
Example output:
/dev/md2 / ext3 defaults,noatime 1 1
/dev/sda3 none swap sw
/dev/sdb3 none swap sw
/dev/vg00/usr /usr ext4 defaults,noatime 0 2
/dev/vg00/var /var ext4 defaults,usrquota,noatime 0 2
/dev/vg00/home /home ext4 defaults,usrquota,noatime 0 2
devpts /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /tmp tmpfs defaults 0 0Analyse the output:
Flat file system (e.g. Debian 13): /usr, /var, and /home are not listed as separate partitions. You do not need to mount any additional partitions. Continue with the next step.
Partitioned system (LVM): /usr, /var, and /home are listed as separate partitions, as in the example above. Mount these partitions. Example:
rescue:~# mount /dev/vg00/usr /mnt/usr
rescue:~# mount /dev/vg00/var /mnt/var
rescue:~# mount /dev/vg00/home /mnt/home
To make the device files and system information available in the mounted system, enter the following commands:
rescue:~# mount --bind /dev /mnt/dev
rescue:~# mount --bind /dev/pts /mnt/dev/pts
rescue:~# mount --bind /proc /mnt/proc
rescue:~# mount --bind /sys /mnt/sysTo check that all partitions are mounted, enter the following command:
rescue:~# mount
/dev/ram0 on / type ext4 (rw,relatime,block_validity,delalloc,barrier,user_xattr,acl)
devtmpfs on /dev type devtmpfs (rw,relatime,size=8116868k,nr_inodes=2029217,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/md126 on /mnt type ext3 (rw,relatime,data=ordered)
/dev/mapper/vg00-usr on /mnt/usr type ext4 (rw,relatime,data=ordered)
/dev/mapper/vg00-var on /mnt/var type ext4 (rw,relatime,data=ordered)
/dev/mapper/vg00-home on /mnt/home type ext4 (rw,relatime,data=ordered)The output must contain an entry for /mnt and for each additional partition you have mounted.
To switch to the mounted system, enter the following command:
rescue:~# chroot /mnt
To set a new password for the root user, enter the following command:
rescue:/# passwd
Enter the new password and confirm it.
To exit the chroot environment, enter the following command:
rescue:/# exit
To unmount all partitions, enter the following command:
rescue:~# umount -R /mnt
Switch back to the Cloud Panel.
Click Actions > Restart. The Restart Server window opens.
Select the Current operating system method.
Click Yes.
The server restarts. You can then log in to the server with your new password.