Reset root Password2024/12/20 |
If you forgot root Password, it's possible to reset it like follows. |
|
[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 (6.12.0-35.el10.x86_64) 10 (Coughlan) | | CentOS Stream (6.12.0-32.el10.x86_64) 10 (Coughlan) | | CentOS Stream (0-rescue-13e0d866d1054d54a96f6690117098a8) 10 (Coughlan) | | | | | | | | | | | | | | | | | | | +----------------------------------------------------------------------------+ Use the ^ and v keys to select which entry is highlighted. Press enter to boot the selected OS, `e' to edit the commands before booting or `c' for a command-line. # add [rw init=/bin/bash] to the end of [linux] line +----------------------------------------------------------------------------+ |load_video | |set gfxpayload=keep | |insmod gzio | |linux ($root)/vmlinuz-6.12.0-35.el10.x86_64 root=/dev/mapper/cs-root ro res\| |ume=UUID=5fa38690-3750-415e-99a3-155a720bc1bf rd.lvm.lv=cs/root rd.lvm.lv=c\| |s/swap console=ttyS0,115200n8 crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M \| |rw init=/bin/bash | |initrd ($root)/initramfs-6.12.0-35.el10.x86_64.img $tuned_initrd | | | | | | | | | +----------------------------------------------------------------------------+ Minimum Emacs-like screen editing is supported. TAB lists completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a command-line or ESC to discard edits and return to the GRUB menu. # after inputting above, push [Ctrl-x] key to proceed ..... ..... [ OK ] Stopped dracut-cmdline.service - dracut cmdline hook. Starting initrd-udevadm-cleanup-db.service - Cleanup udev Database... [ OK ] Stopped systemd-tmpfiles-setup-dev…Create Static Device Nodes in /dev. [ OK ] Stopped systemd-sysusers.service - Create System Users. [ OK ] Stopped systemd-tmpfiles-setup-dev…ic Device Nodes in /dev gracefully. [ OK ] Stopped kmod-static-nodes.service …Create List of Static Device Nodes. # after prompt is displayed, do like follows bash-5.2# # set SELinux relabeling on next boot if you enabling SELinux bash-5.2# touch /.autorelabel
# set password bash-5.2# passwd Changing password for user root. New password: Retype new password: passwd: all authentication tokens updated successfully. # restart System and complete to reset bash-5.2# exec /sbin/init
|
|