For Cloud Servers with CentOS Stream 8

Forget the admin 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 you created the server and or otherwise subsequently change the automatically assigned initial password, you can view the password created for your server in the Cloud Panel.

Starting the KVM Console

  • Log in to your IONOS account.

  • Click on the Server & Cloud tile. If you have multiple contracts, select the desired Server & Cloud contract.

  • In the Infrastructure > Servers section of the Cloud Panel, select the desired server.

  • To launch the KVM console, click Actions > Access KVM Console.

    The KVM console will open in a new tab.

  • Switch back to the Cloud Panel tab.

  • Click Actions > Restart.

  • Select the Hardware method and click Yes.

  • Immediately switch to the KVM console tab and hold down the Shift key to open the Grub Start menu.

Notes
  • When entering the Grub Start menu, the Shift key must be pressed immediately after rebooting.

  • On some servers, you may need to press the Esc key instead of the Shift key.

Editing Startup Entries with GRUB

  • From the GRUB Start menu, press the e key to edit the startup entry.

  • At the end of the line that begins with the string linux ($root)/, add the following parameters:

    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.lvm.lv=centos/root rd.l\ vm.lv=centos/swap rd.break enforcing=0

    The rd.break parameter causes the boot process to be interrupted before transferring control from initramfs to systemd. This allows the initramfs prompt to be used for command entry.

    The enforcing=0 parameter puts SELinux into permissive mode. This saves the later - possibly very time-consuming - relabeling of the file system, which would be necessary if SELinux was switched off.

  • Press Ctrl+x to boot the system with the changed parameters.

    The switch_root prompt of initramfs is displayed.

Please Note

If the file system is encrypted, the prompt for password entry may be hidden by system messages. If this is the case, press the Backspace key once. The prompt should now be displayed again.

Changing the Password

  • Since the file system under /sysroot/ is mounted with read-only privileges, you must first remount it with write privileges:

    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 using passwd:

    sh-4.4# passwd
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully

Please Note

If passwd terminates 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 exit the chroot environment, enter the following command:

    exit

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

    reboot -f

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