CentOS 8.x reset root password using grub and single user mode

From Notes_Wiki

Home > CentOS > CentOS 8.x > System Administration > CentOS 8.x reset root password using grub and single user mode

To reset root password in CentOS 8.x machine use:

  1. Press 'up' or 'down' arrow key to stop booting at grub. Note that right arrow, space bar, enter etc. will cause grub to boot using selected menu item.
  2. Edit the line starting with linux and replace 'ro' with 'rw init=/sysroot/bin/sh'
  3. Boot into single mode using 'Ctrl + X ' shortcut
  4. Use following command to mount root filesystem at /
    chroot /sysroot/
  5. Change the password using:
    passwd root
  6. If SELinux is enabled then use
    touch /.autorelabel
  7. Restart the machine
    shutdown -r now


Refer:


Home > CentOS > CentOS 8.x > System Administration > CentOS 8.x reset root password using grub and single user mode