Forgot Root Password (Linux Dedicated Server)
Article translated by machine
This text is a machine translation. A revised version is planned.
Please use the “Print” function at the bottom of the page to create a PDF.
For Dedicated Servers, Server Power Deals and Value Dedicated Servers managed in the server administration of the IONOS account
This article explains how to reset your server's root password if you forget it.
If you have forgotten your server's root password, you can boot it into the rescue system. During this process, a temporary password is displayed for the selected rescue system. With this password you can log into the rescue system as administrator via SSH. You can then reset your server's root password.
Step 1
Step 2
Log into the rescue system of your server with the user name root and the temporary password.
step 3
Mount the root partition.
Software RAID:
mount /dev/md1 /mnt
Hardware RAID:
mount /dev/sda1 /mnt
Step 4
For the next steps it is necessary to mount the partitions for /usr, /home and /var.
The corresponding devices can be taken from the fstab of the mounted partition:
cat /mnt/etc/fstab
/dev/md1 / ext3 defaults 1 1
/dev/sda2 none swap sw
/dev/sdb2 none swap sw
/dev/vg00/usr /usr xfs defaults 0 2
/dev/vg00/var /var xfs defaults,usrquota 0 2
/dev/vg00/home /home xfs defaults,usrquota 0 2
devpts /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /tmp tmpfs defaults 0 0
In this example we mount the partitions as follows:
mount /dev/vg00/usr /mnt/usr
mount /dev/vg00/var /mnt/var
mount /dev/vg00/home /mnt/home
Step 5
Use the mount command to check that all partitions are mounted:
mount
/dev/ram0 on / type ext2 (rw,relatime,errors=continue,user_xattr,acl)
devtmpfs on /dev type devtmpfs (rw,relatime,size=8123300k,nr_inodes=2030825,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/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/md1 on /mnt type ext3 (rw,relatime,errors=continue,barrier=1,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)
Step 6
Place the mounted partitions in a change root environment:
chroot /mnt
Step 7
Now you can set a new password with passwd:
passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Step 8
To exit the chroot environment, enter the Exit command.
exit
exit
rescue:~#
Step 9
Unmount the partitions:
umount -al
Step 10
Boot the server's server back into the normal system.
To do this, log back in to IONOS and select Recovery Tool again. Then, in the settings, change the boot mode to Normal System and force the reboot.
Once the server has restarted, you can connect to the new password via SSH as root.