Reset root Password2025/06/19 |
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 +----------------------------------------------------------------------------+ |*Rocky Linux (6.12.0-55.16.1.el10_0.x86_64) 10.0 (Red Quartz) | | Rocky Linux (6.12.0-55.14.1.el10_0.x86_64) 10.0 (Red Quartz) | | Rocky Linux (6.12.0-55.12.1.el10_0.x86_64) 10.0 (Red Quartz) | | Rocky Linux (0-rescue-11b7ae1538764e02baf69001e45bbd9b) 10.0 (Red Quartz) | | | | | | | | | | | | | | | | | +----------------------------------------------------------------------------+ 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. The highlighted entry will be executed automatically in 2s. # add [rw init=/bin/bash] to the end of the [linux] line +----------------------------------------------------------------------------+ |load_video | |set gfxpayload=keep | |insmod gzio | |linux ($root)/vmlinuz-6.12.0-55.16.1.el10_0.x86_64 root=/dev/mapper/rl-root\| | ro resume=UUID=972443ac-f8aa-4244-8ae8-f7eb46088b15 rd.lvm.lv=rl/root rd.l\| |vm.lv=rl/swap console=ttyS0,115200n8 crashkernel=2G-64G:256M,64G-:512M \ | |rw init=/bin/bash | |initrd ($root)/initramfs-6.12.0-55.16.1.el10_0.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
|
|