CentOS 8
Sponsored Link

Reset root Password2020/03/10

 
If you forgot root Password, it's possible to reset it like follows.
(This is only for the case GRUB boot loader Password is not set)
[1] Restart System and when GRUB2 boot menu is displayed, Push [e] key.
Next, Proceed like follows to reset root password.
      # push [e] key
      CentOS Linux (4.18.0-147.5.1.el8_1.x86_64) 8 (Core)
      CentOS Linux (4.18.0-147.3.1.el8_1.x86_64) 8 (Core)
      CentOS Linux (4.18.0-80.11.2.el8_0.x86_64) 8 (Core)
      CentOS Linux (0-rescue-b3f4d72a5acb4909897845f43ce9df64) 8 (Core)

      Use the ^ and v keys to change the selection.
      Press 'e' to edit the selected item, or 'c' for a command prompt.

     # add [rw init=/bin/bash] to the end of [linux] line
     load_video
     set gfx_payload=keep
     insmod gzio
     linux ($root)/vmlinuz-4.18.0-147.5.1.el8_1.x86_64 root=/dev/mapper/cl-root ro \
     crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swa\
     p console=ttyS0,115200n8 rw init=/bin/bash
     initrd  ($root)/initramfs-4.18.0-147.5.1.el8_1.x86_64.img $tuned_initrd

      Press Ctrl-x to start, Ctrl-c for a command prompt or Escape to
      discard edits and return to the menu. Pressing Tab lists
      possible completions.

      # after inputting above, push [Ctrl-x] key to proceed
.....
.....

[    4.027227] SGI XFS with ACLs, security attributes, no debug enabled
[    4.031995] XFS (dm-0): Mounting V5 Filesystem
[    4.038038] XFS (dm-0): Ending clean mount
[    4.362473] systemd-journald[231]: Received SIGTERM from PID 1 (systemd).
[    4.377833] bash: 16 output lines suppressed due to ratelimiting

# after initramfs switch_root prompt is displayed, do like follows
bash-4.4#

# set SELinux relabeling on next boot if you enabling SELinux

bash-4.4#
touch /.autorelabel
# set password

bash-4.4#
passwd

Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
# restart System and complete to reset

bash-4.4#
exec /sbin/init
Matched Content