How to reset the root the password in Centos

If you have forgotten the root password on CentOS or other RHEL based Linux distributions, you can reset it easily bye following the steps below.

Boot the system to single user mode

Start the system and press any key within 3 seconds at the boot screen to enter the GRUB menu

CentOS boot

Once you are on the GRUB menu press 'a' to modify kernel arguments.

CentOS grub menu

Type in rhgb quiet single and press enter.

CentOS single user

This will take you to a root shell. To change the password simply type the command passwd

# passwd
Changing password for user root.

New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Type the command reboot and press enter to reboot the system.

# reboot

Login with your new password.

Post a comment


Your Comment

Email (We dont publish it)


Nothing the first to share wisdom.