Valid for Dedicated Servers which are managed in the Cloud Panel.

In this article, you will learn how to reset the root password of your Linux Dedicated Server using the Rescue System.

How to reset the root password of your Dedicated Server running Linux:

Requirements

  • The server is switched on.

  • You have created an image of the server in question.

  • 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.

  • Select the desired server in the Infrastructure > Servers area.

  • Click on Actions > Restart. The Restart server window opens.

  • Activate the Rescue System method.

  • Click Yes
    The server is booted into the Rescue System.

  • Scroll down to the Features section.

  • Establish an encrypted network connection to your server via SSH using the access data displayed. Alternatively, to use the VNC console, click on the downward-pointing arrow next to the Console button and then on VNC Console.
  • To retrieve information about all disks, enter the following command:

    rescue:~# fdisk -l

  • Determine the root partition. The name of the root partition of a dedicated server with software RAID is md126 or md2. The name of the root partition of a dedicated server with hardware RAID contains the designation sda2. Examples: 

    Software RAID:

    Disk /dev/md127: 419.2 GiB, 450103148544 bytes, 879107712 sectors
    Units: sectors of 1 * 512 = 512 bytes

    Hardware RAID:

    /dev/sda2 6144 58593279 58587136 28G Linux filesystem

  • To mount the root partition, enter the following command:

    rescue:~# mount /dev/MYROOTPARTITION /mnt

    Replace the placeholder MYROOTPARTITION with the name of the root partition of your dedicated server. Examples:

    Software RAID:

    rescue:~# mount /dev/md126 /mnt

     

    rescue:~# mount /dev/md2 /mnt

    Hardware RAID:

    rescue:~# mount /dev/sda2 /mnt

  • For the next steps it is necessary to mount the partitions for /usr, /home, and /var. To display the contents of the fstab file and determine the associated device files, enter the following command:

    rescue:~# cat /mnt/etc/fstab

    The contents of the fstab file will be displayed. Example:

    /dev/md2 / ext3 defaults,noatime 1 1
    /dev/sda3 none swap sw
    /dev/sdb3 none swap sw
    /dev/vg00/usr /usrext4 defaults,noatime 0 2
    /dev/vg00/var /var ext4 defaults,usrquota,noatime 0 2
    /dev/vg00/home /home ext4defaults,usrquota,noatime 0 2
    devpts /dev/pts devptsgid=5,mode=620 0 0
    none /proc proc defaults 0 0
    none /tmp tmpfs defaults 0 0

  • Mount the partitions for /usr, /home, and /var. Example:

    rescue:~# mount /dev/vg00/usr /mnt/usr
    mount /dev/vg00/var /mnt/var
    mount /dev/vg00/home /mnt/home

  • Use the mount command to check whether all partitions are mounted:

    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)

  • Place the mounted partitions in a chroot environment:

    rescue:~# chroot /mnt

  • To set a new password, enter the following command:

    rescue:~# passwd

  • Enter the new password and repeat it.

  • Open the Cloud Panel.

  • Click on Actions > Restart. The Restart server window opens.

  • Activate the Current operating system method.

  • Click on Yes.

The server is restarted. You can then log in to the server with the new password.