Note : Take Backup of your data before you proceed
Method 1 - (CentOS/RHEL/Fedora)
Step1 :- Restart the MachineStep2 :- Press "e" from keyboard at time when kernel versions presented Press "e" again
Step3 :- Search for "rd.break" line (last line of Linux16) or write next to rw file (rw init=/sysroot/bin/sh)
Step4 :- Press Ctrl+X(control+x) to start on single user mode
Step5 :- Type at command line "mount -o remount, rw /sysimage"
chroot /sysimage or chroot /sysroot
passwd root or passwd
load_policy -i or touch /.autorelabel
restorecon /etc/shadow to restore the SELinux settings for the given file
reboot or exit
Method 2 - (CentOS/RHEL/Fedora)
Step1 :- Boot/Restart the Virtual Machine or ServerStep2 :- Then Select Troubleshooting see below screenshot
Step3 :- Then Select Rescue a CentOS system and hit Enter
Step4 :- Then type 1 and hit enter a couple of times until you get the command prompt (shell).
Step5 :- Then type in command prompt one by one
Chroot /mnt/sysimage
Passwd
Rm -f /.autorelabel
Exit
Exit
Step6 :- After Reboot Login with New Password
Method 3 - (CentOS/RHEL/Fedora)
Step1 :- Boot/Restart the Virtual Machine or ServerStep2 :- Interrupt while booting at GRUB Stage with any arrow or space bar from keyboard
Step3 :- Type "e" to edit kernel argument, 'ESC' is used for Cancel or to goback
Step4 :- Then type 1 after rhgb quiet line hit enter to boot
Step5 :- Press "b" to boot process then type "runlevel" in command prompt 1S is single user mode
Step6 :- Type New Password and Again Same Password
Step7 :- Reboot it
0 Comments