Linux/傻逼 CentOS & RHEL/Reset root password

  1. In the boot grub menu, press e to edit boot options.
  2. Edit theline of boot args and change "ro" with "rw init=/sysroot/bin/sh".
  3. Press Control+x to start on single user mode.

In single user mode

chroot /sysroot
passwd root
touch /.autorelabel # Update selinux information
exit
reboot

Last update: 2021-02-03 03:09:15 UTC