Recover Forgotten Root Password in CentOS/Redhat
Sometimes users forget root password. In Linux password can be recovered by booting Linux under single user mode and creating new password by entering bash shell prompt.
In order to boot system under single user mode we need to reboot the system.
- Reboot the system, during booting process it will ask to press any key to enter the menu:
- Pressing any key will show Grub Menu where you can select Kernel version:
- After highlighting the option with UP/Down Arrow key press ‘e’ in order to edit commands in Grub menu screen, it will show option where one can select Kernel Version. Make sure you select the option starting with ‘Kernel /vmlinuz-….’ and again press ‘e’.
- After pressing ‘e’ it will take you to Kernel Boot Option where you need to give single space and type ‘1’ or ‘S’ or ‘Single’ at the end of the line then press ENTER.
- Now press b (Note: These options are temporary in order to recover root password) which will boot the system in single user mode and Bash prompt will be displayed.
- Now Type command ‘passwd‘and it will ask for new password.
- Enter new password and reconfirm the same which will update the password.
- Now you can enter any run level from this prompt by typing ‘init runlevel’ where runlevel can range from 1 to 6.
Tags:
forgot root password,
Linux root password,
recover forgotten root password,
recover root password,
root password,