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:
- 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.
- Edit the line starting with linux and replace 'ro' with 'rw init=/sysroot/bin/sh'
- Boot into single mode using 'Ctrl + X ' shortcut
- Use following command to mount root filesystem at /
- chroot /sysroot/
- Change the password using:
- passwd root
- If SELinux is enabled then use
- touch /.autorelabel
- 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