Reset root Password2021/07/20 |
|
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
Rocky Linux (4.18.0-305.3.1.el8_4.x86_64) 8.4 (Green Obsidian)
Rocky Linux (0-rescue-98bc67d7659a4dd185060002cd4cc38a) 8.4 (Green Obsid>
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-305.3.1.el8_4.x86_64 root=/dev/mapper/rl-root ro \
crashkernel=auto resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swa\
p console=ttyS0,115200n8 rw init=/bin/bash
initrd ($root)/initramfs-4.18.0-305.3.1.el8_4.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 Load Kernel Modules.
[ OK ] Stopped target Swap.
[ OK ] Started Cleaning Up and Shutting Down Daemons.
[ OK ] Stopped udev Kernel Device Manager.
[ OK ] Stopped Create Static Device Nodes in /dev.
[ OK ] Stopped Create list of required sta…vice nodes for the current kernel.
[ OK ] Stopped dracut pre-udev hook.
[ OK ] Stopped dracut cmdline hook.
[ OK ] Closed udev Kernel Socket.
[ OK ] Closed udev Control Socket.
Starting Cleanup udevd DB...
# 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 |
|
|