Reset root Password2021/02/23 |
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 Stream (4.18.0-240.el8.x86_64) 8 CentOS Stream (0-rescue-54f4bd7df8464337a3009215fdef55fb) 8 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-240.el8.x86_64 root=/dev/mapper/cs-root ro crashk\ ernel=auto resume=/dev/mapper/cs-swap rd.lvm.lv=cs/root rd.lvm.lv=cs/swap cons\ ole=ttyS0,115200n8 rw init=/bin/bash initrd ($root)/initramfs-4.18.0-240.el8.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 ..... ..... [ OK ] Stopped dracut pre-udev hook. [ OK ] Stopped dracut cmdline hook. [ OK ] Closed udev Control Socket. [ OK ] Closed udev Kernel Socket. Starting Cleanup udevd DB... [ OK ] Stopped Hardware RNG Entropy Gatherer Daemon. [ OK ] Started Plymouth switch root service. [ 5.747712] systemd-journald[303]: Received SIGTERM from PID 1 (systemd). [ 5.765776] printk: bash: 18 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
|
Sponsored Link |