For IONOS Cloud Servers and Virtual Cloud Servers with CentOS 8

Forgot the administrator (root) password of your server? We will show you how to reset it using the KVM console.

Please Note

If you did not set your own password when creating the server and did not change the automatically assigned password afterwards, you can display the initial password in the Cloud Panel.

  • Open the KVM console.

  • Restart the server and press the e button in the GRUB start menu to edit the startup entry.

  • Add the following parameters at the end of the line starting with linux ($root)/:
    rd.break enforcing=0
    The line should now look something like this:
    linux ($root)/vmlinuz-4.18.0-80.11.2.el8_0.x86_64 root=/dev/mapper/centos-root\ ro crashkernel=auto resume=/dev/mapper/centos-swap rd.l\ rd.break enforcing=0
    The parameter rd.break causes the boot process to be interrupted before control is passed from initramfs to systemd. This allows the initramfs prompt to be used for command input, and the parameter enforcing=0 puts SELinux in permissive mode. This saves the later - and possibly very time-consuming - relabeling of the file system, which would be necessary if SELinux were switched off.

  • Press Ctrl+x to boot the system with the changed parameters, and the switch_root prompt of initramfs will be displayed.

Please Note

If the file system is encrypted, the password prompt may be overlaid by the system messages and therefore not be visible. In this case, briefly press the Backspace key. Now the prompt should be displayed again.

  • Since the filesystem under /sysroot/ is mounted with read-only permissions, you must first remount it with write permissions:
    switch_root:/# mount -o remount,rw /sysroot

  • Now switch to a chroot environment:
    switch_root:/# chroot /sysroot
    The prompt changes to sh-4.4#.

  • Now you can change the password via passwd:
    sh-4.4# passwd
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully

Please Note

If passwd aborts with the message Authentication token manipulation error, you must exit the chroot environment again and remount /sysroot with write permissions as described in the previous step.

  • To leave the chroot environment, type the following command: exit

  • Reboot the server. To do this, enter the following command: reboot

The server now boots back into the normal system. You can then log in with your new password.